Use existing registry mirror for PostgreSQL CI
This commit is contained in:
@@ -81,23 +81,24 @@ jobs:
|
||||
|
||||
- name: Preload PostgreSQL integration image
|
||||
env:
|
||||
POSTGRES_TEST_SOURCE_IMAGE: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/library/postgres:17-alpine
|
||||
POSTGRES_TEST_IMAGE: postgres:17-alpine
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if docker image inspect "$POSTGRES_TEST_IMAGE" >/dev/null 2>&1; then
|
||||
exit 0
|
||||
if ! docker image inspect "$POSTGRES_TEST_IMAGE" >/dev/null 2>&1; then
|
||||
for attempt in 1 2 3; do
|
||||
if timeout 180 docker pull "$POSTGRES_TEST_SOURCE_IMAGE"; then
|
||||
docker tag "$POSTGRES_TEST_SOURCE_IMAGE" "$POSTGRES_TEST_IMAGE"
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -eq 3 ]; then
|
||||
echo "Failed to preload $POSTGRES_TEST_IMAGE after $attempt attempts" >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep $((attempt * 15))
|
||||
done
|
||||
fi
|
||||
for attempt in 1 2 3; do
|
||||
if timeout 180 docker pull "$POSTGRES_TEST_IMAGE"; then
|
||||
docker image inspect "$POSTGRES_TEST_IMAGE" >/dev/null
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -eq 3 ]; then
|
||||
echo "Failed to pull $POSTGRES_TEST_IMAGE after $attempt attempts" >&2
|
||||
exit 1
|
||||
fi
|
||||
sleep $((attempt * 15))
|
||||
done
|
||||
docker image inspect "$POSTGRES_TEST_IMAGE" >/dev/null
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
|
||||
@@ -138,10 +138,22 @@ test("Gitea quality gate validates before publishing an immutable ACR manifest",
|
||||
assert.match(workflow, /sha256sum -c -/);
|
||||
assert.match(workflow, /docker compose version --short/);
|
||||
assert.match(workflow, /docker compose --help \| grep -q -- '--project-name'/);
|
||||
assert.match(
|
||||
workflow,
|
||||
/POSTGRES_TEST_SOURCE_IMAGE: swr\.cn-north-4\.myhuaweicloud\.com\/ddn-k8s\/docker\.io\/library\/postgres:17-alpine/,
|
||||
);
|
||||
assert.match(workflow, /POSTGRES_TEST_IMAGE: postgres:17-alpine/);
|
||||
assert.match(workflow, /docker image inspect "\$POSTGRES_TEST_IMAGE"/);
|
||||
assert.match(workflow, /for attempt in 1 2 3/);
|
||||
assert.match(workflow, /timeout 180 docker pull "\$POSTGRES_TEST_IMAGE"/);
|
||||
assert.match(
|
||||
workflow,
|
||||
/timeout 180 docker pull "\$POSTGRES_TEST_SOURCE_IMAGE"/,
|
||||
);
|
||||
assert.match(
|
||||
workflow,
|
||||
/docker tag "\$POSTGRES_TEST_SOURCE_IMAGE" "\$POSTGRES_TEST_IMAGE"/,
|
||||
);
|
||||
assert.doesNotMatch(workflow, /docker pull "\$POSTGRES_TEST_IMAGE"/);
|
||||
assert.ok(
|
||||
workflow.indexOf("Preload PostgreSQL integration image") <
|
||||
workflow.indexOf("npm test --prefix frontend"),
|
||||
|
||||
Reference in New Issue
Block a user