-
Notifications
You must be signed in to change notification settings - Fork 338
242 lines (240 loc) · 10.4 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
name: Beekeeper
on:
repository_dispatch:
types: [trigger-beekeeper, beekeeper]
pull_request:
branches:
- "**"
env:
K3S_VERSION: "v1.30.3+k3s1"
REPLICA: 3
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE: "ethersphere/bee-localchain"
SETUP_CONTRACT_IMAGE_TAG: "0.9.2-rc7"
BEELOCAL_BRANCH: "main"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
REACHABILITY_OVERRIDE_PUBLIC: true
BATCHFACTOR_OVERRIDE_PUBLIC: 2
TIMEOUT: 30m
BUCKET_NAME: swarm-beekeeper-artifacts
AWS_ACCESS_KEY_ID: ${{ secrets.DO_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DO_AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
AWS_ENDPOINT: fra1.digitaloceanspaces.com
VERTAG: ${GITHUB_RUN_ID}
jobs:
init:
name: Init
runs-on: ubuntu-latest
outputs:
msg: ${{ steps.commit.outputs.msg }}
steps:
- name: Checkout
uses: actions/checkout@v4
if: github.event.action != 'beekeeper'
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4
if: github.event.action == 'beekeeper'
with:
fetch-depth: 0
ref: ${{ github.event.client_payload.ref }}
- name: Setup Go
uses: actions/setup-go@v5
with:
cache: false
go-version-file: go.mod
- name: Cache Go Modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Get Commit Message
id: commit
run: |
MSG=$(git log --format=%s -n 1 ${{github.event.after}})
echo "msg=${MSG}" >> $GITHUB_OUTPUT
- name: Build - 0
run: |
make binary
mv dist/bee bee-0
- name: Apply patches and build - 1
run: |
patch pkg/api/postage.go .github/patches/postage_api.patch
patch pkg/retrieval/retrieval.go .github/patches/retrieval.patch
make binary
mv dist/bee bee-1
- name: Install beekeeper
run: |
export PATH=$(pwd):$PATH
timeout ${TIMEOUT} make beekeeper BEEKEEPER_INSTALL_DIR=$(pwd)
beekeeper version --log-verbosity 0
mv ~/.beekeeper.yaml .beekeeper.yaml
mv ~/.beekeeper/local.yaml local.yaml
- uses: actions/upload-artifact@v4
with:
name: temp-artifacts
include-hidden-files: true
path: |
Dockerfile.goreleaser
Makefile
bee-0
bee-1
bee-2
beekeeper
local.yaml
.beekeeper.yaml
.github/bin/beekeeper_artifacts.sh
retention-days: 5
beekeeper:
name: Integration tests
runs-on: ubuntu-latest
needs: [init]
steps:
- name: Cache
uses: actions/cache@v4
with:
path: |
/tmp/k3s-${{ env.K3S_VERSION }}
key: k3s-${{ env.K3S_VERSION }}
- name: "Download Artifact"
uses: actions/download-artifact@v4
with:
name: temp-artifacts
- name: Unpack artifacts
run: |
chmod +x bee-1 beekeeper .github/bin/beekeeper_artifacts.sh
mv .beekeeper.yaml ~/.beekeeper.yaml
mkdir ~/.beekeeper && mv local.yaml ~/.beekeeper/local.yaml
mv bee-1 bee
sudo mv beekeeper /usr/local/bin/beekeeper
- name: Prepare local cluster
run: |
timeout ${TIMEOUT} make beelocal OPTS='ci skip-vet' ACTION=prepare
- name: Set kube config
run: |
mkdir -p ~/.kube
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
- name: Set local cluster
run: |
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 gsoc
id: gsoc
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks=ci-gsoc
- 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 postage stamps
id: postage-stamps
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks ci-postage
- name: Test staking
id: stake
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks ci-stake
- name: Test withdraw
id: withdraw
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-withdraw; do echo "waiting for withdraw..."; sleep .3; done'
- name: Test redundancy
id: redundancy
run: timeout ${TIMEOUT} beekeeper check --cluster-name local-dns --checks ci-redundancy
- name: Test act
id: act
run: timeout ${TIMEOUT} bash -c 'until beekeeper check --cluster-name local-dns --checks ci-act; do echo "waiting for act..."; sleep .3; done'
- name: Collect debug artifacts
if: failure()
run: |
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
if ${{ steps.act.outcome=='failure' }}; then FAILED=act; fi
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}\`\"}" https://beehive.ethswarm.org/hooks/${{ secrets.TUNSHELL_KEY }}
echo "Failed test: ${FAILED}"
- name: Create tunshell session for debug
if: failure() && contains(needs.init.outputs.msg, '[debug]')
run: |
KEYS=$(curl -sSf -X POST https://eu.relay.tunshell.com/api/sessions)
curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**Integration tests** Beekeeper Debug\nBranch: \`${{ github.head_ref }}\`\nUser: @${{ github.event.pull_request.user.login }}\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 "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@v4
if: failure()
with:
name: debug-dump
path: dump/
retag:
name: Retag and Trigger ArgoCD
env:
TIMEOUT: 10m
needs: [beekeeper]
runs-on: ubuntu-latest
steps:
- name: "Download Artifact"
uses: actions/download-artifact@v4
with:
name: temp-artifacts
- name: Unpack artifacts
run: |
chmod +x bee-0
mv bee-0 bee
- name: Build image
run: |
timeout ${TIMEOUT} make beelocal ACTION=build OPTS='ci skip-vet skip-push'
- 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
if: github.ref == 'refs/heads/master' && github.event.action != 'beekeeper' && success()
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.GHA_PAT_BASIC }}
repository: ethersphere/bee-factory
event-type: build-images
client-payload: '{"tag": "latest"}'