-
Notifications
You must be signed in to change notification settings - Fork 341
383 lines (381 loc) · 18.2 KB
/
beekeeper.yml
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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
name: Beekeeper
on:
repository_dispatch:
types: [trigger-beekeeper, beekeeper]
pull_request:
branches:
- '**'
jobs:
beekeeper:
name: Integration tests
env:
REPLICA: 3
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE_TAG: "0.2.0"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
REACHABILITY_OVERRIDE_PUBLIC: true
BATCHFACTOR_OVERRIDE_PUBLIC: 2
TIMEOUT: 10m
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Checkout
uses: actions/checkout@v2
if: github.event.action != 'beekeeper'
with:
fetch-depth: 1
- name: Checkout
uses: actions/checkout@v2
if: github.event.action == 'beekeeper'
with:
ref: ${{ github.event.client_payload.ref }}
fetch-depth: 1
- name: Cache
uses: actions/cache@v2
with:
path: |
/tmp/k3s-v1.20.15+k3s1
key: k3s-v1.20.15+k3s1
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Apply patches
run: |
patch pkg/postage/postagecontract/contract.go .github/patches/postagecontract.patch
patch pkg/postage/service.go .github/patches/postageservice.patch
- name: Prepare local cluster
run: |
printf ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $ --password-stdin
timeout ${TIMEOUT} make beekeeper BEEKEEPER_INSTALL_DIR=/usr/local/bin BEEKEEPER_USE_SUDO=true
timeout ${TIMEOUT} make beelocal OPTS='ci skip-vet'
- name: Set kube config
run: |
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- name: Set local cluster
run: |
timeout ${TIMEOUT} make beelocal ACTION=add-hosts
timeout ${TIMEOUT} make deploylocal BEEKEEPER_CLUSTER=local-dns
- name: Test pingpong
id: pingpong
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-pingpong; do echo "waiting for pingpong..."; sleep .3; done'
- name: Test fullconnectivity
id: fullconnectivity
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks=ci-full-connectivity; do echo "waiting for full connectivity..."; sleep .3; done'
- name: Test settlements
id: settlements
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-settlements
- name: Sleep for time allowance to replenish
run: sleep 2
- name: Test pss
id: pss
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-pss
- name: Test soc
id: soc
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-soc
- name: Test pushsync (chunks)
id: pushsync-chunks-1
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-pushsync-chunks
- name: Test pushsync (light mode chunks)
id: pushsync-chunks-2
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-pushsync-light-chunks
- name: Test retrieval
id: retrieval
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-retrieval
- name: Test manifest
id: manifest
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-manifest
- name: Test content availability
id: content-availability
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-content-availability
- name: Test authenticate
id: authenticate
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-authenticate; do echo "waiting for auth..."; sleep .3; done'
- name: Test postage stamps
id: postage-stamps
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks ci-postage
- name: Debug workflow if failed
if: failure()
run: |
export BUCKET_NAME=swarm-beekeeper-artifacts
export AWS_ACCESS_KEY_ID=${{ secrets.DO_AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.DO_AWS_SECRET_ACCESS_KEY }}
export AWS_EC2_METADATA_DISABLED=true
export AWS_ENDPOINT=fra1.digitaloceanspaces.com
export VERTAG=${GITHUB_RUN_ID}
bash .github/bin/beekeeper_artifacts.sh local-dns
export FAILED='no-test'
if ${{ steps.pingpong.outcome=='failure' }}; then FAILED=pingpong; fi
if ${{ steps.fullconnectivity.outcome=='failure' }}; then FAILED=fullconnectivity; fi
if ${{ steps.settlements.outcome=='failure' }}; then FAILED=settlements; fi
if ${{ steps.pss.outcome=='failure' }}; then FAILED=pss; fi
if ${{ steps.soc.outcome=='failure' }}; then FAILED=soc; fi
if ${{ steps.pushsync-chunks-1.outcome=='failure' }}; then FAILED=pushsync-chunks-1; fi
if ${{ steps.pushsync-chunks-2.outcome=='failure' }}; then FAILED=pushsync-chunks-2; fi
if ${{ steps.retrieval.outcome=='failure' }}; then FAILED=retrieval; fi
if ${{ steps.manifest.outcome=='failure' }}; then FAILED=manifest; fi
if ${{ steps.content-availability.outcome=='failure' }}; then FAILED=content-availability; fi
KEYS=$(curl -sSf -X POST https://eu.relay.tunshell.com/api/sessions)
curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**${RUN_TYPE}** Beekeeper Error\nBranch: \`${{ github.head_ref }}\`\nUser: @${{ github.event.pull_request.user.login }}\nDebugging artifacts: [click](https://$BUCKET_NAME.$AWS_ENDPOINT/artifacts_$VERTAG.tar.gz)\nStep failed: \`${FAILED}\`\nDebug shell: \`sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.TUNSHELL_KEY }}
echo "Failed test: ${FAILED}"
echo "Connect to github actions node using"
echo "sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com"
curl -sSf https://lets.tunshell.com/init.sh | sh /dev/stdin T $(echo $KEYS | jq -r .peer1_key) ${{ secrets.TUNSHELL_SECRET }} eu.relay.tunshell.com
- uses: actions/upload-artifact@v3
if: failure()
with:
name: debug-dump
path: dump/
beekeeper-clef:
name: Integration tests (clef enabled)
env:
REPLICA: 3
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE_TAG: "0.2.0"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
REACHABILITY_OVERRIDE_PUBLIC: true
BATCHFACTOR_OVERRIDE_PUBLIC: 2
TIMEOUT: 10m
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Checkout
uses: actions/checkout@v2
if: github.event.action != 'beekeeper'
with:
fetch-depth: 1
- name: Checkout
uses: actions/checkout@v2
if: github.event.action == 'beekeeper'
with:
ref: ${{ github.event.client_payload.ref }}
fetch-depth: 1
- name: Cache
uses: actions/cache@v2
with:
path: |
/tmp/k3s-v1.20.15+k3s1
key: k3s-v1.20.15+k3s1
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Apply patches
run: |
patch pkg/postage/postagecontract/contract.go .github/patches/postagecontract.patch
patch pkg/postage/service.go .github/patches/postageservice.patch
- name: Prepare testing cluster (Node connection and clef enabled)
run: |
printf ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $ --password-stdin
timeout ${TIMEOUT} make beekeeper BEEKEEPER_INSTALL_DIR=/usr/local/bin BEEKEEPER_USE_SUDO=true
timeout ${TIMEOUT} make beelocal OPTS='ci skip-vet'
- name: Set kube config
run: |
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- name: Set local cluster
run: |
timeout ${TIMEOUT} make beelocal ACTION=add-hosts
timeout ${TIMEOUT} make deploylocal BEEKEEPER_CLUSTER=local-clef
- name: Test pingpong
id: pingpong
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-clef --checks ci-pingpong; do echo "waiting for pingpong..."; sleep .3; done'
- name: Test fullconnectivity
id: fullconnectivity
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-clef --checks=ci-full-connectivity; do echo "waiting for full connectivity..."; sleep .3; done'
- name: Test settlements
id: settlements
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-clef --checks=ci-settlements-clef
- name: Debug workflow if failed
if: failure()
run: |
export BUCKET_NAME=swarm-beekeeper-artifacts
export AWS_ACCESS_KEY_ID=${{ secrets.DO_AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.DO_AWS_SECRET_ACCESS_KEY }}
export AWS_EC2_METADATA_DISABLED=true
export AWS_ENDPOINT=fra1.digitaloceanspaces.com
export VERTAG=${GITHUB_RUN_ID}
bash .github/bin/beekeeper_artifacts.sh local-clef
export FAILED='no-test'
if ${{ steps.pingpong.outcome=='failure' }}; then FAILED=pingpong; fi
if ${{ steps.fullconnectivity.outcome=='failure' }}; then FAILED=fullconnectivity; fi
if ${{ steps.settlements.outcome=='failure' }}; then FAILED=settlements; fi
KEYS=$(curl -sSf -X POST https://eu.relay.tunshell.com/api/sessions)
curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**${RUN_TYPE}** Beekeeper Error\nBranch: \`${{ github.head_ref }}\`\nUser: @${{ github.event.pull_request.user.login }}\nDebugging artifacts: [click](https://$BUCKET_NAME.$AWS_ENDPOINT/artifacts_$VERTAG.tar.gz)\nStep failed: \`${FAILED}\`\nDebug shell: \`sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.TUNSHELL_KEY }}
echo "Failed test: ${FAILED}"
echo "Connect to github actions node using"
echo "sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com"
curl -sSf https://lets.tunshell.com/init.sh | sh /dev/stdin T $(echo $KEYS | jq -r .peer1_key) ${{ secrets.TUNSHELL_SECRET }} eu.relay.tunshell.com
- uses: actions/upload-artifact@v3
if: failure()
with:
name: debug-dump
path: dump/
beekeeper-si:
name: Integration tests (storage incentives)
env:
REPLICA: 3
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE_TAG: "0.2.0"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
REACHABILITY_OVERRIDE_PUBLIC: true
BATCHFACTOR_OVERRIDE_PUBLIC: 2
TIMEOUT: 10m
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Checkout
uses: actions/checkout@v2
if: github.event.action != 'beekeeper'
with:
fetch-depth: 1
- name: Checkout
uses: actions/checkout@v2
if: github.event.action == 'beekeeper'
with:
ref: ${{ github.event.client_payload.ref }}
fetch-depth: 1
- name: Cache
uses: actions/cache@v2
with:
path: |
/tmp/k3s-v1.20.15+k3s1
key: k3s-v1.20.15+k3s1
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Apply patches
run: |
patch pkg/postage/postagecontract/contract.go .github/patches/postagecontract.patch
patch pkg/postage/service.go .github/patches/postageservice.patch
patch pkg/postage/batchstore/reserve.go .github/patches/postagereserve_gc.patch
- name: Prepare testing cluster (storage incentives setup)
run: |
printf ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $ --password-stdin
timeout ${TIMEOUT} make beekeeper BEEKEEPER_INSTALL_DIR=/usr/local/bin BEEKEEPER_USE_SUDO=true
timeout ${TIMEOUT} make beelocal OPTS='ci skip-vet'
- name: Set kube config
run: |
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- name: Set testing cluster (storage incentives setup)
run: |
timeout ${TIMEOUT} make beelocal ACTION=add-hosts
timeout ${TIMEOUT} make deploylocal BEEKEEPER_CLUSTER=local-gc
- name: Test pingpong
id: pingpong
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-gc --checks ci-pingpong; do echo "waiting for pingpong..."; sleep .3; done'
- name: Test gc
id: gc-chunk
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-gc --checks=ci-gc
- name: Debug workflow if failed
if: failure()
run: |
export BUCKET_NAME=swarm-beekeeper-artifacts
export AWS_ACCESS_KEY_ID=${{ secrets.DO_AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.DO_AWS_SECRET_ACCESS_KEY }}
export AWS_EC2_METADATA_DISABLED=true
export AWS_ENDPOINT=fra1.digitaloceanspaces.com
export VERTAG=${GITHUB_RUN_ID}
bash .github/bin/beekeeper_artifacts.sh local-gc
export FAILED='no-test'
if ${{ steps.pingpong.outcome=='failure' }}; then FAILED=pingpong; fi
if ${{ steps.gc-chunk.outcome=='failure' }}; then FAILED=gc-chunk; fi
KEYS=$(curl -sSf -X POST https://eu.relay.tunshell.com/api/sessions)
curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**${RUN_TYPE}** Beekeeper Error\nBranch: \`${{ github.head_ref }}\`\nUser: @${{ github.event.pull_request.user.login }}\nDebugging artifacts: [click](https://$BUCKET_NAME.$AWS_ENDPOINT/artifacts_$VERTAG.tar.gz)\nStep failed: \`${FAILED}\`\nDebug shell: \`sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.TUNSHELL_KEY }}
echo "Failed test: ${FAILED}"
echo "Connect to github actions node using"
echo "sh <(curl -sSf https://lets.tunshell.com/init.sh) L $(echo $KEYS | jq -r .peer2_key) \${TUNSHELL_SECRET} eu.relay.tunshell.com"
curl -sSf https://lets.tunshell.com/init.sh | sh /dev/stdin T $(echo $KEYS | jq -r .peer1_key) ${{ secrets.TUNSHELL_SECRET }} eu.relay.tunshell.com
- uses: actions/upload-artifact@v3
if: failure()
with:
name: debug-dump
path: dump/
retag:
name: Retag and Trigger ArgoCD
env:
TIMEOUT: 10m
needs: [beekeeper, beekeeper-si, beekeeper-clef]
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Checkout
uses: actions/checkout@v2
if: github.event.action != 'beekeeper'
with:
fetch-depth: 1
- name: Checkout
uses: actions/checkout@v2
if: github.event.action == 'beekeeper'
with:
ref: ${{ github.event.client_payload.ref }}
fetch-depth: 1
- name: Cache
uses: actions/cache@v2
with:
path: |
/tmp/k3s-v1.20.15+k3s1
key: k3s-v1.20.15+k3s1
- name: Cache Go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
- name: Build image
run: |
printf ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $ --password-stdin
timeout ${TIMEOUT} make beelocal ACTION=build OPTS='ci skip-vet skip-push'
- name: Retag Docker image and push for cache
if: success()
run: |
docker tag k3d-registry.localhost:5000/ethersphere/bee:latest ghcr.io/ethersphere/bee
docker push ghcr.io/ethersphere/bee
- name: Retag Docker image and push
if: github.ref == 'refs/heads/master' && github.event.action != 'beekeeper' && success()
run: |
docker tag k3d-registry.localhost:5000/ethersphere/bee:latest ethersphere/bee:latest
docker tag k3d-registry.localhost:5000/ethersphere/bee:latest quay.io/ethersphere/bee:latest
printf ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
printf ${{ secrets.QUAY_PASSWORD }} | docker login --username ${{ secrets.QUAY_USERNAME }} quay.io --password-stdin
docker push ethersphere/bee:latest
docker push quay.io/ethersphere/bee:latest
echo RUN_TYPE="MERGE RUN" >> $GITHUB_ENV
- name: Trigger Bee Factory latest build
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GHA_PAT_BASIC }}
repository: ethersphere/bee-factory
event-type: build-images
client-payload: '{"tag": "latest"}'
- name: Set IMAGE_DIGEST variable
if: github.ref == 'refs/heads/master' && github.event.action != 'beekeeper' && success()
run: echo "IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ethersphere/bee:latest | cut -d'@' -f 2 | tr -d '\n')" >> $GITHUB_ENV
- name: Trigger ArgoCD
if: github.ref == 'refs/heads/master' && github.event.action != 'beekeeper' && success()
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GHA_PAT_BASIC }}
repository: ethersphere/bee-argo
event-type: trigger-argo
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "digest": "${{ env.IMAGE_DIGEST }}"}'