-
Notifications
You must be signed in to change notification settings - Fork 19
244 lines (209 loc) · 9.37 KB
/
end-to-end-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: end-to-end-test
on:
pull_request_target:
types: [ labeled ]
workflow_dispatch:
env:
chartuser: ${{ secrets.DEV_CHARTS_USERNAME }}
chartpassword: ${{ secrets.DEV_CHARTS_PASSWORD }}
dockeruser: ${{ secrets.DOCKER_USERNAME }}
dockerpassword: ${{ secrets.DOCKER_TOKEN }}
ENFORCE_CRITICAL_CHECK: ${{ secrets.ENFORCE_CRITICAL_CHECK }}
jobs:
end-to-end:
if: ${{ github.event.label.name == 'ready-to-test' }}
runs-on: ubuntu-20.04
steps:
- name: Check disk space
run: df . -h
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Check disk space
run: |
df . -h
- name: checkout the repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Check working space directory
run: du ${GITHUB_WORKSPACE} -h -d 1
- name: Set outputs
id: vars
run: echo "::set-output name=sha_commit::$(git rev-parse HEAD)"
- name: Get branch name
id: branch-name
uses: tj-actions/[email protected]
- name: build the worker operator
uses: docker/build-push-action@v2
with:
tags: worker-operator:${{ steps.vars.outputs.sha_commit }}
build-args: |
PLATFORM=amd64
push: false
- name: Scanning image for vulnerablilities
uses: aquasecurity/trivy-action@master
with:
image-ref: worker-operator:${{ steps.vars.outputs.sha_commit }}
format: 'table'
output: 'scan.txt'
- name: check files
run: |
ls -ltr
cat scan.txt
- name: extract lines for base and binary image
run: |
bash .github/workflows/scripts/line-extractor.sh
- name: check file is created or not
run: |
ls -ltr
echo "base image file content:"
cat final.txt
echo "binary image file content:"
cat binary.txt
- name: break the bulid if critical vulunerablitites in base image
if: env.ENFORCE_CRITICAL_CHECK == 'true'
run: |
bash .github/workflows/scripts/base-image-critical.sh
- name: break the bulid if critical vulunerablitites in binary image
if: env.ENFORCE_CRITICAL_CHECK == 'true'
run: |
bash .github/workflows/scripts/binary-image-critical.sh
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: trivy-scan
path: scan.txt
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
- name: Check disk space
run: |
df . -h
- name: build kind clusters
run: |
mkdir -p ${{ github.workspace }}/profile
bash .github/workflows/scripts/start-kind.sh
env:
GITHUB_HEAD_COMMIT: ${{ steps.vars.outputs.sha_commit }}
- name: Free disk space
run: |
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1
sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
echo "some packages purged"
- name: Check disk space
run: |
df . -h
- name: Docker Run Action
uses: addnab/docker-run-action@v3
with:
username: ${{ env.dockeruser }}
password: ${{ env.dockerpassword }}
registry: docker.io
image: aveshadev/kubeslice-e2e:latest
options: -v ${{ github.workspace }}/reports:/e2e/reports -v /home/runner/.kube:/e2e/assets/kubeconfig -v ${{ github.workspace }}/profile:/e2e/profile --network kind
run: |
bash run.sh kind
- name: Check disk space
run: |
df . -h
- name: Free disk space
run: |
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm || true
echo "some directories deleted"
sudo apt install aptitude -y >/dev/null 2>&1
sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \
esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \
google-cloud-sdk imagemagick \
libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \
mercurial apt-transport-https mono-complete libmysqlclient \
unixodbc-dev yarn chrpath libssl-dev libxft-dev \
libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \
snmp pollinate libpq-dev postgresql-client powershell ruby-full \
sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \
-y -f >/dev/null 2>&1
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
sudo apt-get autoremove -y >/dev/null 2>&1
sudo apt-get autoclean -y >/dev/null 2>&1
echo "some packages purged"
- name: Check disk space
run: |
sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head
df . -h
sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head
- name: Checkout gh-pages repo
uses: actions/checkout@v2
with:
repository: kubeslice/e2e-allure-reports
path: gh-pages
ref: 'gh-pages'
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H:%M:%S')"
- name: Allure Report with history
uses: PavanMudigonda/[email protected]
id: Allure_report_with_history
with:
allure_results: reports
allure_report: allure_report
allure_history: allure-history
gh_pages: gh-pages
keep_reports: 500
github_run_id: '${{ github.run_id }}'
github_run_num: 'Kind-${{ github.event.repository.name }}-${{ steps.date.outputs.date }}-${{ github.base_ref }}-${{ github.run_number }}'
report_url: 'https://kubeslice.github.io/e2e-allure-reports/'
test_env: Kind
- name: Deploy report to Github Pages
uses: peaceiris/actions-gh-pages@v2
env:
PUBLISH_BRANCH: gh-pages
PERSONAL_TOKEN: ${{ secrets.TOKEN }}
EXTERNAL_REPOSITORY: kubeslice/e2e-allure-reports
PUBLISH_DIR: allure-history
keep_files: true
- name: wait for report deploy on site ( you can check report here also )
run: |
sleep 200
echo 'https://kubeslice.github.io/e2e-allure-reports/Kind-${{ github.event.repository.name }}-${{ steps.date.outputs.date }}-${{ github.base_ref }}-${{ github.run_number }}/index.html'
- name: Report link on Pull Request comment
if: ${{ github.event_name == 'pull_request_target' }}
uses: thollander/actions-comment-pull-request@v1
with:
message: |
report link 'https://kubeslice.github.io/e2e-allure-reports/Kind-${{ github.event.repository.name }}-${{ steps.date.outputs.date }}-${{ github.base_ref }}-${{ github.run_number }}/index.html'
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Run Quality Gate Check
uses: ./quality-gate
with:
ENABLE_QUALITY_GATE: true
MINIMUM_PASS_PERCENTAGE: 75
ALLURE_BEHAVIORS_CSV: '/home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/allure-history/Kind-${{ github.event.repository.name }}-${{ steps.date.outputs.date }}-${{ github.base_ref }}-${{ github.run_number }}/data/behaviors.csv'
- name: Send mail
if: always()
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
username: ${{secrets.MAIL_USERNAME}}
password: ${{secrets.MAIL_PASSWORD}}
subject: Worker-Operator | worker-end-to-end-test | ${{ steps.date.outputs.date }}
from: [email protected]
attachments: result-summary.txt
body: Pipeline for the repo ${{github.repository}} is triggered by ${{github.actor}} from the branch ${{ steps.branch-name.outputs.current_branch }} !
Run id for the pipeline is ${{ github.run_id }} .
Check your logs in github action here https://github.com/kubeslice/worker-operator/actions/runs/${{ github.run_id }} .
for downloading the logs zip file in your local use this API url in curl command https://api.github.com/repos/kubeslice/worker-operator/actions/runs/${{ github.run_id }}/logs
the report url is https://kubeslice.github.io/e2e-allure-reports/Kind-${{ github.event.repository.name }}-${{ steps.date.outputs.date }}-${{ github.base_ref }}-${{ github.run_number }}/index.html.
for looking all the allure reports (including old ones ) please visit at https://kubeslice.github.io/e2e-allure-reports/ .
please look result-summary.txt file for more info regarding test cases ( please note you will get result-summary.txt file only if your quality gate check steps ran successfully ).