Skip to content

Commit b7e8a35

Browse files
authored
feat: makefile beekeeper (ethersphere#1931)
1 parent 27205bb commit b7e8a35

File tree

2 files changed

+55
-46
lines changed

2 files changed

+55
-46
lines changed

Diff for: .github/workflows/beekeeper.yml

+36-44
Original file line numberDiff line numberDiff line change
@@ -37,115 +37,106 @@ jobs:
3737
with:
3838
path: ~/go/pkg/mod
3939
key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }}
40-
- name: Install bee-local
41-
run: |
42-
export URL=$(curl -s https://api.github.com/repos/ethersphere/bee-local/releases/latest | jq -r .tarball_url)
43-
curl -Ls ${URL} -o bee-local.tar.gz
44-
tar --strip-components=1 --wildcards -xzf bee-local.tar.gz ethersphere-bee-local-*/{beeinfra.sh,helm-values,hack}
45-
- name: Install latest beekeeper
46-
run: |
47-
export TAG=$(curl -s https://api.github.com/repos/ethersphere/beekeeper/releases/latest | jq -r .tag_name)
48-
curl -Ls https://github.com/ethersphere/beekeeper/releases/download/${TAG}/beekeeper-linux-amd64 -o beekeeper
49-
chmod +x beekeeper
50-
- name: Prepare testing cluster (DNS discovery)
40+
- name: Prepare local cluster
5141
run: |
5242
printf ${{ secrets.CR_PAT }} | docker login ghcr.io -u bee-worker --password-stdin
53-
timeout 30m ./beeinfra.sh prepare --geth --k3s
43+
make beekeeper BEEKEEPER_INSTALL_DIR=/usr/local/bin BEEKEEPER_USE_SUDO=true
44+
timeout 10m make beelocal OPTS='ci skip-vet'
5445
- name: Set kube config
5546
run: |
5647
mkdir -p ~/.kube
5748
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
58-
echo "kubeconfig: ${HOME}/.kube/config" > ~/.beekeeper.yaml
5949
- name: Apply patches
6050
run: |
6151
patch pkg/postage/batchstore/reserve.go .github/patches/postagereserve.patch
6252
patch pkg/postage/postagecontract/contract.go .github/patches/postagecontract.patch
6353
patch pkg/postage/listener/listener.go .github/patches/listener.patch
64-
- name: Set testing cluster (DNS discovery)
54+
- name: Set local cluster
6555
run: |
66-
echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts
67-
for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts
68-
timeout 30m ./beeinfra.sh install --local -r "${REPLICA}" --bootnode /dnsaddr/localhost --geth --k3s --pay-threshold 1500000000000 --postage
56+
make beelocal ACTION=add-hosts
57+
timeout 10m make deploylocal BEEKEEPER_CLUSTER=local-dns
6958
- name: Test pingpong
7059
id: pingpong-1
71-
run: until ./beekeeper check pingpong --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"; do echo "waiting for pingpong..."; sleep .3; done
60+
run: until beekeeper check --cluster-name local-dns --checks ci-pingpong; do echo "waiting for pingpong..."; sleep .3; done
7261
- name: Test fullconnectivity
7362
id: fullconnectivity-1
74-
run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
63+
run: beekeeper check --cluster-name local-dns --checks=ci-full-connectivity
7564
- name: Test settlements
7665
id: settlements-1
77-
run: |
78-
./beekeeper check settlements --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" -t 1500000000000
79-
sleep 2
66+
run: beekeeper check --cluster-name local-dns --checks=ci-settlements
67+
- name: Sleep for time allowance to replenish
68+
run: sleep 2
8069
- name: Test pss
8170
id: pss
82-
run: ./beekeeper check pss --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --timeout 5m
71+
run: beekeeper check --cluster-name local-dns --checks=ci-pss
8372
- name: Test soc
8473
id: soc
85-
run: ./beekeeper check soc --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
74+
run: beekeeper check --cluster-name local-dns --checks=ci-soc
8675
- name: Test pushsync (chunks)
8776
id: pushsync-chunks-1
88-
run: ./beekeeper check pushsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3 --upload-chunks --retry-delay 15s
77+
run: beekeeper check --cluster-name local-dns --checks=ci-pushsync-chunks
8978
- name: Test retrieval
9079
id: retrieval-1
91-
run: ./beekeeper check retrieval --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
80+
run: beekeeper check --cluster-name local-dns --checks=ci-retrieval
9281
- name: Test manifest
9382
id: manifest-1
94-
run: ./beekeeper check manifest --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
83+
run: beekeeper check --cluster-name local-dns --checks=ci-manifest
9584
- name: Destroy the cluster
9685
run: |
97-
./beeinfra.sh uninstall
86+
beekeeper delete bee-cluster --cluster-name local-dns
87+
make beelocal ACTION=uninstall
9888
- name: Prepare testing cluster (Node connection and clef enabled)
9989
run: |
100-
timeout 30m ./beeinfra.sh prepare --geth --clef --k3s
90+
timeout 10m make beelocal OPTS='ci skip-vet'
10191
- name: Set kube config
10292
run: |
10393
mkdir -p ~/.kube
10494
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
10595
- name: Set testing cluster (Node connection and clef enabled)
10696
run: |
107-
timeout 30m ./beeinfra.sh install --local -r "${REPLICA}" --geth --clef --k3s --pay-threshold 1500000000000 --postage
97+
timeout 10m make deploylocal BEEKEEPER_CLUSTER=local-clef
10898
- name: Test pingpong
10999
id: pingpong-2
110-
run: until ./beekeeper check pingpong --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"; do echo "waiting for pingpong..."; sleep .3; done
100+
run: until beekeeper check --cluster-name local-clef --checks ci-pingpong; do echo "waiting for pingpong..."; sleep .3; done
111101
- name: Test fullconnectivity
112102
id: fullconnectivity-2
113-
run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
103+
run: beekeeper check --cluster-name local-clef --checks=ci-full-connectivity
114104
- name: Test settlements
115105
id: settlements-2
116-
run: ./beekeeper check settlements --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" -t 1500000000000
106+
run: beekeeper check --cluster-name local-clef --checks=ci-settlements-clef
117107
- name: Destroy the cluster
118108
run: |
119-
./beeinfra.sh uninstall
109+
beekeeper delete bee-cluster --cluster-name local-clef
110+
make beelocal ACTION=uninstall
120111
- name: Apply patches
121112
run: |
122113
patch pkg/postage/batchstore/reserve.go .github/patches/postagereserve_gc.patch
123114
- name: Prepare testing cluster (storage incentives setup)
124115
run: |
125-
timeout 10m ./beeinfra.sh prepare --geth --k3s
116+
timeout 10m make beelocal OPTS='ci skip-vet'
126117
- name: Set kube config
127118
run: |
128119
mkdir -p ~/.kube
129120
cp /etc/rancher/k3s/k3s.yaml ~/.kube/config
130121
- name: Set testing cluster (storage incentives setup)
131122
run: |
132-
timeout 10m ./beeinfra.sh install --local -r "${REPLICA}" --geth --k3s --pay-threshold 1500000000000 --postage --db-capacity 100
123+
timeout 10m make deploylocal BEEKEEPER_CLUSTER=local-gc
124+
- name: Test pingpong
125+
id: pingpong-3
126+
run: until beekeeper check --cluster-name local-gc --checks ci-pingpong; do echo "waiting for pingpong..."; sleep .3; done
133127
- name: Test gc
134128
id: gc-chunk-1
135-
run: ./beekeeper check gc --cache-capacity 100 --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
136-
- name: Destroy the cluster
137-
run: |
138-
./beeinfra.sh uninstall
129+
run: beekeeper check --cluster-name local-gc --checks=ci-gc
139130
- name: Retag Docker image and push for cache
140131
if: success()
141132
run: |
142-
docker tag registry.localhost:5000/ethersphere/bee:latest ghcr.io/ethersphere/bee
133+
docker tag k3d-registry.localhost:5000/ethersphere/bee:latest ghcr.io/ethersphere/bee
143134
docker push ghcr.io/ethersphere/bee
144135
- name: Retag Docker image and push
145136
if: github.ref == 'refs/heads/master' && github.event.action != 'beekeeper' && success()
146137
run: |
147-
docker tag registry.localhost:5000/ethersphere/bee:latest ethersphere/bee:latest
148-
docker tag registry.localhost:5000/ethersphere/bee:latest quay.io/ethersphere/bee:latest
138+
docker tag k3d-registry.localhost:5000/ethersphere/bee:latest ethersphere/bee:latest
139+
docker tag k3d-registry.localhost:5000/ethersphere/bee:latest quay.io/ethersphere/bee:latest
149140
printf ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
150141
printf ${{ secrets.QUAY_PASSWORD }} | docker login --username ${{ secrets.QUAY_USERNAME }} quay.io --password-stdin
151142
docker push ethersphere/bee:latest
@@ -172,12 +163,13 @@ jobs:
172163
if ${{ steps.pushsync-chunks-1.outcome=='failure' }}; then FAILED=pushsync-chunks-1; fi
173164
if ${{ steps.retrieval-1.outcome=='failure' }}; then FAILED=retrieval-1; fi
174165
if ${{ steps.manifest-1.outcome=='failure' }}; then FAILED=manifest-1; fi
175-
if ${{ steps.gc-chunk-1.outcome=='failure' }}; then FAILED=gc-chunk-1; fi
176166
if ${{ steps.pingpong-2.outcome=='failure' }}; then FAILED=pingpong-2; fi
177167
if ${{ steps.fullconnectivity-2.outcome=='failure' }}; then FAILED=fullconnectivity-2; fi
178168
if ${{ steps.settlements-2.outcome=='failure' }}; then FAILED=settlements-2; fi
179169
if ${{ steps.pss.outcome=='failure' }}; then FAILED=pss; fi
180170
if ${{ steps.soc.outcome=='failure' }}; then FAILED=soc; fi
171+
if ${{ steps.pingpong-3.outcome=='failure' }}; then FAILED=pingpong-3; fi
172+
if ${{ steps.gc-chunk-1.outcome=='failure' }}; then FAILED=gc-chunk-1; fi
181173
KEYS=$(curl -sSf -X POST https://eu.relay.tunshell.com/api/sessions)
182174
curl -sSf -X POST -H "Content-Type: application/json" -d "{\"text\": \"**${RUN_TYPE}** ${{ github.head_ref }}\nFailed -> \`${FAILED}\`\nDebug -> \`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.WEBHOOK_KEY }}
183175
echo "Failed test: ${FAILED}"

Diff for: Makefile

+19-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ GOLANGCI_LINT ?= $$($(GO) env GOPATH)/bin/golangci-lint
33
GOLANGCI_LINT_VERSION ?= v1.30.0
44
GOGOPROTOBUF ?= protoc-gen-gogofaster
55
GOGOPROTOBUF_VERSION ?= v1.3.1
6-
BEEKEEPER ?= $$($(GO) env GOPATH)/bin/beekeeper
6+
BEEKEEPER_INSTALL_DIR ?= $$($(GO) env GOPATH)/bin
7+
BEEKEEPER_USE_SUDO ?= false
8+
BEEKEEPER_CLUSTER ?= local
79
BEELOCAL_BRANCH ?= main
10+
BEEKEEPER_BRANCH ?= master
811

912
COMMIT ?= "$(shell git describe --long --dirty --always --match "" || true)"
1013
LDFLAGS ?= -s -w -X github.com/ethersphere/bee.commit="$(COMMIT)"
@@ -23,12 +26,26 @@ dist:
2326

2427
.PHONY: beekeeper
2528
beekeeper:
26-
test -f $(BEEKEEPER) || curl -sSfL https://raw.githubusercontent.com/ethersphere/beekeeper/master/install.sh | BEEKEEPER_INSTALL_DIR=$$($(GO) env GOPATH)/bin USE_SUDO=false bash
29+
curl -sSfL https://raw.githubusercontent.com/ethersphere/beekeeper/master/scripts/install.sh | BEEKEEPER_INSTALL_DIR=$(BEEKEEPER_INSTALL_DIR) USE_SUDO=$(BEEKEEPER_USE_SUDO) bash
30+
test -f ~/.beekeeper.yaml || curl -sSfL https://raw.githubusercontent.com/ethersphere/beekeeper/$(BEEKEEPER_BRANCH)/config/beekeeper-local.yaml -o ~/.beekeeper.yaml
31+
mkdir -p ~/.beekeeper && curl -sSfL https://raw.githubusercontent.com/ethersphere/beekeeper/$(BEEKEEPER_BRANCH)/config/local.yaml -o ~/.beekeeper/local.yaml
2732

2833
.PHONY: beelocal
2934
beelocal:
3035
curl -sSfL https://raw.githubusercontent.com/ethersphere/beelocal/$(BEELOCAL_BRANCH)/beelocal.sh | bash
3136

37+
.PHONY: deploylocal
38+
deploylocal:
39+
beekeeper create bee-cluster --cluster-name $(BEEKEEPER_CLUSTER)
40+
41+
.PHONY: testlocal
42+
testlocal:
43+
export PATH=${PATH}:$$($(GO) env GOPATH)/bin
44+
beekeeper check --cluster-name local --checks=ci-full-connectivity,ci-gc,ci-manifest,ci-pingpong,ci-pss,ci-pushsync-chunks,ci-retrieval,ci-settlements,ci-soc
45+
46+
.PHONY: testlocal-all
47+
all: beekeeper beelocal deploylocal testlocal
48+
3249
.PHONY: lint
3350
lint: linter
3451
$(GOLANGCI_LINT) run

0 commit comments

Comments
 (0)