Skip to content

Commit 78a3289

Browse files
committed
feat(redis): update .github/workflows/cluster.yaml to use redis
Note .github/workflows/cluster.yaml has been broken for a while and silently failing. The reason it has been broken is the 3 zot instances were trying to open the same boltdb file in order to write. This became apparent in: 8553712#diff-afd8186ad1553f2a9918413c02ec9e361ae0a11aa973af7fd447115f2ae4202e Signed-off-by: Andrei Aaron <[email protected]>
1 parent 1099917 commit 78a3289

File tree

2 files changed

+82
-4
lines changed

2 files changed

+82
-4
lines changed

.github/workflows/cluster.yaml

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ jobs:
7272
--retry-max-time 120 \
7373
'http://localhost:9000/minio/health/live'
7474
75+
- name: Setup redis service
76+
run: |
77+
docker run -d -p 6379:6379 --name redis \
78+
--health-cmd "redis-cli ping" \
79+
--health-interval 10s \
80+
--health-timeout 5s \
81+
--health-retries 5 \
82+
redis:7.4.2
83+
7584
- name: Create minio bucket
7685
run: |
7786
python3 - <<'EOF'
@@ -101,12 +110,15 @@ jobs:
101110
cp test/cluster/config-minio.json test/cluster/config-minio1.json
102111
sed -i 's/8081/8081/g' test/cluster/config-minio1.json
103112
sed -i 's/\/tmp\/zot/\/tmp\/zot1/g' test/cluster/config-minio1.json
113+
sed -i 's/\/dev\/null/\/tmp\/zot1.log/g' test/cluster/config-minio1.json
104114
cp test/cluster/config-minio.json test/cluster/config-minio2.json
105115
sed -i 's/8081/8082/g' test/cluster/config-minio2.json
106116
sed -i 's/\/tmp\/zot/\/tmp\/zot2/g' test/cluster/config-minio2.json
117+
sed -i 's/\/dev\/null/\/tmp\/zot2.log/g' test/cluster/config-minio2.json
107118
cp test/cluster/config-minio.json test/cluster/config-minio3.json
108119
sed -i 's/8081/8083/g' test/cluster/config-minio3.json
109120
sed -i 's/\/tmp\/zot/\/tmp\/zot3/g' test/cluster/config-minio3.json
121+
sed -i 's/\/dev\/null/\/tmp\/zot3.log/g' test/cluster/config-minio3.json
110122
111123
- name: Free up disk space
112124
uses: jlumbroso/free-disk-space@main
@@ -126,6 +138,12 @@ jobs:
126138
./bin/zot-linux-amd64 serve test/cluster/config-minio2.json &
127139
./bin/zot-linux-amd64 serve test/cluster/config-minio3.json &
128140
sleep 20
141+
142+
# ensure the instances are online
143+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8081/v2/
144+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8082/v2/
145+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8082/v2/
146+
129147
# run tests
130148
skopeo --debug copy --format=oci --dest-tls-verify=false docker://ghcr.io/project-zot/golang:1.20 docker://localhost:8080/golang:1.20
131149
skopeo --debug copy --src-tls-verify=false docker://localhost:8080/golang:1.20 oci:golang:1.20
@@ -139,46 +157,102 @@ jobs:
139157
oras pull --plain-http localhost:8080/hello-artifact:v2 -d -v
140158
grep -q "hello world" artifact.txt # should print "hello world"
141159
if [ $? -ne 0 ]; then \
142-
killall -r zot-*; \
160+
killall --wait -r zot-*; \
143161
exit 1; \
144162
fi
145163
146-
killall -r zot-*
164+
killall --wait -r zot-*
165+
166+
# archive logs
167+
zip logs-push-pull.zip /tmp/*.log -r
168+
169+
# clean zot storage
170+
sudo rm -rf /tmp/data/zot-storage/zot
171+
# clean zot cache and metadb
172+
docker exec redis redis-cli FLUSHDB
173+
# clean zot logs
174+
rm /tmp/*.log
147175
env:
148176
AWS_ACCESS_KEY_ID: minioadmin
149177
AWS_SECRET_ACCESS_KEY: minioadmin
150178

179+
- name: Upload zot logs for push-pull tests
180+
uses: actions/upload-artifact@v4
181+
if: always()
182+
with:
183+
name: logs-push-pull.zip
184+
path: logs-push-pull.zip
185+
if-no-files-found: error
186+
151187
- name: Run benchmark with --src-cidr arg
152188
run: |
153189
./bin/zot-linux-amd64 serve test/cluster/config-minio1.json &
154190
./bin/zot-linux-amd64 serve test/cluster/config-minio2.json &
155191
./bin/zot-linux-amd64 serve test/cluster/config-minio3.json &
156192
sleep 20
193+
194+
# ensure the instances are online
195+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8081/v2/
196+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8082/v2/
197+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8082/v2/
198+
157199
# run zb with --src-cidr
158200
bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd --src-cidr 127.0.0.0/8 http://localhost:8080
159201
160-
killall -r zot-*
202+
killall --wait -r zot-*
203+
204+
# archive logs
205+
zip logs-src-cidr.zip /tmp/*.log -r
161206
162207
# clean zot storage
163208
sudo rm -rf /tmp/data/zot-storage/zot
209+
# clean zot cache and metadb
210+
docker exec redis redis-cli FLUSHDB
211+
# clean zot logs
212+
rm /tmp/*.log
164213
env:
165214
AWS_ACCESS_KEY_ID: minioadmin
166215
AWS_SECRET_ACCESS_KEY: minioadmin
167216

217+
- name: Upload zot logs for cidr tests
218+
uses: actions/upload-artifact@v4
219+
if: always()
220+
with:
221+
name: logs-src-cidr.zip
222+
path: logs-src-cidr.zip
223+
if-no-files-found: error
224+
168225
- name: Run benchmark with --src-ips arg
169226
run: |
170227
./bin/zot-linux-amd64 serve test/cluster/config-minio1.json &
171228
./bin/zot-linux-amd64 serve test/cluster/config-minio2.json &
172229
./bin/zot-linux-amd64 serve test/cluster/config-minio3.json &
173230
sleep 20
231+
232+
# ensure the instances are online
233+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8081/v2/
234+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8082/v2/
235+
curl --connect-timeout 3 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 --retry-connrefused http://localhost:8082/v2/
236+
174237
# run zb with --src-ips
175238
bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd --src-ips 127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5,127.0.0.6,127.0.12.5,127.0.12.6 http://localhost:8080
176239
177-
killall -r zot-*
240+
killall --wait -r zot-*
241+
242+
# archive logs
243+
zip logs-src-ips.zip /tmp/*.log -r
178244
env:
179245
AWS_ACCESS_KEY_ID: minioadmin
180246
AWS_SECRET_ACCESS_KEY: minioadmin
181247

248+
- name: Upload zot logs for src-ips tests
249+
uses: actions/upload-artifact@v4
250+
if: always()
251+
with:
252+
name: logs-src-ips.zip
253+
path: logs-src-ips.zip
254+
if-no-files-found: error
255+
182256
# Download previous benchmark result from cache (if exists)
183257
- name: Download previous benchmark data
184258
uses: actions/cache@v4

test/cluster/config-minio.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"rootDirectory": "/tmp/zot",
55
"gc": true,
66
"dedupe": false,
7+
"cacheDriver": {
8+
"name": "redis",
9+
"url": "redis://localhost:6379"
10+
},
711
"storageDriver": {
812
"name": "s3",
913
"rootdirectory": "/zot",

0 commit comments

Comments
 (0)