Skip to content

Commit 9c356de

Browse files
committed
chore(registry): add wait-for-port check
1 parent 5ea0561 commit 9c356de

2 files changed

Lines changed: 24 additions & 13 deletions

File tree

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ FROM registry.drycc.cc/drycc/base:${CODENAME}
1414
ENV DRYCC_UID=1001 \
1515
DRYCC_GID=1001 \
1616
DRYCC_HOME_DIR=/var/lib/registry \
17-
JQ_VERSION="1.6" \
18-
MC_VERSION="2023.06.15.15.08.26" \
17+
JQ_VERSION="1.7" \
18+
MC_VERSION="2023.09.20.15.22.31" \
1919
REGISTRY_VERSION="2.8.2"
2020

2121
COPY rootfs/bin/ /bin/

contrib/ci/test.sh

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,44 @@ set -eoxf pipefail
55
s3Accesskey=drycc
66
s3Secretkey=123456789
77

8-
STORAGE_JOB=$(podman run -d --name storage \
8+
STORAGE_JOB=$(podman run -d --entrypoint init-stack -p 8333:8333 \
99
-e DRYCC_STORAGE_ACCESSKEY=$s3Accesskey \
1010
-e DRYCC_STORAGE_SECRETKEY=$s3Secretkey \
11-
"${DEV_REGISTRY}"/drycc/storage:canary minio server /data/storage/ --console-address :9001)
12-
13-
sleep 5
14-
podman logs "${STORAGE_JOB}"
11+
"${DEV_REGISTRY}"/drycc/storage:canary weed server -dir=/data/hdd -s3)
1512

13+
# wait for port
1614
STORAGE_IP=$(podman inspect --format "{{ .NetworkSettings.IPAddress }}" "${STORAGE_JOB}")
15+
echo -e "\\033[32m---> Waitting for ${STORAGE_IP}:8333\\033[0m"
16+
wait-for-port --host="${STORAGE_IP}" 8333
17+
echo -e "\\033[32m---> S3 service ${STORAGE_IP}:8333 ready...\\033[0m"
18+
podman logs "${STORAGE_JOB}"
1719

18-
JOB=$(podman run --add-host storage:"${STORAGE_IP}" \
19-
-d \
20-
-p 5000:5000 \
20+
JOB=$(podman run -d -p 5000:5000 \
2121
-e REGISTRY_HTTP_SECRET=drycc \
2222
-e DRYCC_REGISTRY_REDIRECT=false \
2323
-e DRYCC_REGISTRY_USERNAME=admin \
2424
-e DRYCC_REGISTRY_PASSWORD=admin \
2525
-e DRYCC_STORAGE_LOOKUP=path \
2626
-e DRYCC_STORAGE_BUCKET=registry \
27-
-e DRYCC_STORAGE_ENDPOINT=http://storage:9000 \
27+
-e DRYCC_STORAGE_ENDPOINT="http://${STORAGE_IP}:8333" \
2828
-e DRYCC_STORAGE_ACCESSKEY=$s3Accesskey \
2929
-e DRYCC_STORAGE_SECRETKEY=$s3Secretkey \
3030
"$1")
3131

32+
# shellcheck disable=SC2317
33+
function clean_before_exit {
34+
# delay before exiting, so stdout/stderr flushes through the logging system
35+
podman kill "${JOB}"
36+
podman kill "${STORAGE_JOB}"
37+
podman rm "${JOB}" "${STORAGE_JOB}"
38+
}
39+
trap clean_before_exit EXIT
40+
3241
# let the registry run for a few seconds
33-
sleep 5
42+
REGISTRY_IP=$(podman inspect --format "{{ .NetworkSettings.IPAddress }}" "${JOB}")
43+
echo -e "\\033[32m---> Waitting for ${REGISTRY_IP}:5000\\033[0m"
44+
wait-for-port --host="${REGISTRY_IP}" 5000
45+
echo -e "\\033[32m---> S3 service ${REGISTRY_IP}:5000 ready...\\033[0m"
3446
# check that the registry is still up
3547
podman logs "${JOB}"
3648
podman ps -q --no-trunc=true | grep "${JOB}"
37-
podman rm -f "${JOB}" "${STORAGE_JOB}"

0 commit comments

Comments
 (0)