Retry PostgreSQL image preload in Gitea CI
This commit is contained in:
@@ -78,6 +78,26 @@ jobs:
|
||||
docker compose version --short | grep -Eq '^v?2\.'
|
||||
docker compose --help | grep -q -- '--project-name'
|
||||
|
||||
- name: Preload PostgreSQL integration image
|
||||
env:
|
||||
POSTGRES_TEST_IMAGE: postgres:17-alpine
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if docker image inspect "$POSTGRES_TEST_IMAGE" >/dev/null 2>&1; then
|
||||
exit 0
|
||||
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
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
@@ -136,6 +136,14 @@ 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_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.ok(
|
||||
workflow.indexOf("Preload PostgreSQL integration image") <
|
||||
workflow.indexOf("npm test --prefix frontend"),
|
||||
);
|
||||
assert.equal((workflow.match(/npm test --prefix frontend/g) ?? []).length, 1);
|
||||
assert.equal((workflow.match(/npm run lint --prefix frontend/g) ?? []).length, 1);
|
||||
assert.equal((workflow.match(/npm run build --prefix frontend/g) ?? []).length, 1);
|
||||
|
||||
Reference in New Issue
Block a user