Retry base image registry operations on transient resets
Some checks failed
CICD / Build and Publish CICD Base Image (push) Successful in 16s
CICD / Build and Push CICD Image (push) Successful in 18m11s
CICD / Build CICD Image Failure Postmortem (push) Has been skipped
CICD / Pre-commit Checks (push) Successful in 2m34s
CICD / Backend Doctests (push) Successful in 24s
CICD / Frontend Tests (push) Successful in 5m35s
CICD / Backend Tests (push) Successful in 11m1s
CICD / Source Lanes Failure Postmortem (push) Has been skipped
CICD / CICD Tests Complete (push) Successful in 7s
CICD / Build Backend Base Image (push) Successful in 2m54s
CICD / Build Integration Tester Image (push) Successful in 1m16s
CICD / Build Backend Main Image (push) Successful in 1m24s
CICD / Build Frontend Base Image (push) Successful in 7m36s
CICD / Build and Publish Runtime Images (Legacy Disabled) (push) Has been skipped
CICD / Build Frontend Main Image (push) Successful in 1m40s
CICD / Build E2E Tester Image (push) Successful in 8m25s
CICD / Runtime Images Failure Postmortem (push) Has been skipped
CICD / Production Images Complete (push) Successful in 7s
CICD / Runtime Black-Box Integration Tests (push) Successful in 5m27s
CICD / Integration Tests Failure Postmortem (push) Has been skipped
CICD / End-to-End Tests (push) Failing after 7m2s
CICD / E2E Tests Failure Postmortem (push) Successful in 13s
Some checks failed
CICD / Build and Publish CICD Base Image (push) Successful in 16s
CICD / Build and Push CICD Image (push) Successful in 18m11s
CICD / Build CICD Image Failure Postmortem (push) Has been skipped
CICD / Pre-commit Checks (push) Successful in 2m34s
CICD / Backend Doctests (push) Successful in 24s
CICD / Frontend Tests (push) Successful in 5m35s
CICD / Backend Tests (push) Successful in 11m1s
CICD / Source Lanes Failure Postmortem (push) Has been skipped
CICD / CICD Tests Complete (push) Successful in 7s
CICD / Build Backend Base Image (push) Successful in 2m54s
CICD / Build Integration Tester Image (push) Successful in 1m16s
CICD / Build Backend Main Image (push) Successful in 1m24s
CICD / Build Frontend Base Image (push) Successful in 7m36s
CICD / Build and Publish Runtime Images (Legacy Disabled) (push) Has been skipped
CICD / Build Frontend Main Image (push) Successful in 1m40s
CICD / Build E2E Tester Image (push) Successful in 8m25s
CICD / Runtime Images Failure Postmortem (push) Has been skipped
CICD / Production Images Complete (push) Successful in 7s
CICD / Runtime Black-Box Integration Tests (push) Successful in 5m27s
CICD / Integration Tests Failure Postmortem (push) Has been skipped
CICD / End-to-End Tests (push) Failing after 7m2s
CICD / E2E Tests Failure Postmortem (push) Successful in 13s
This commit is contained in:
@@ -623,14 +623,44 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
retry_registry_op() {
|
||||
op_name="$1"
|
||||
image_ref="$2"
|
||||
attempts="${3:-5}"
|
||||
backoff="${4:-3}"
|
||||
attempt=1
|
||||
|
||||
while [ "${attempt}" -le "${attempts}" ]; do
|
||||
echo "${op_name} attempt ${attempt}/${attempts} for ${image_ref}"
|
||||
if [ "${op_name}" = "push" ]; then
|
||||
if docker push "${image_ref}"; then
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
if docker pull "${image_ref}" >/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${attempt}" -lt "${attempts}" ]; then
|
||||
sleep_seconds=$((backoff * attempt))
|
||||
echo "Retrying in ${sleep_seconds}s"
|
||||
sleep "${sleep_seconds}"
|
||||
fi
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "${PACKAGE_ACCESS_TOKEN}" | docker login "http://${GITEA_REGISTRY}" -u "${REGISTRY_USER}" --password-stdin
|
||||
BACKEND_BASE_REPO="${GITEA_REGISTRY}/darkhelm.org/plex-playlist-backend-base"
|
||||
BACKEND_BASE_TAG_REF="${BACKEND_BASE_REPO}:${HEAD_SHA}"
|
||||
|
||||
docker build -f Dockerfile.backend --target dependencies -t plex-playlist-backend-base:"${HEAD_SHA}" .
|
||||
docker tag plex-playlist-backend-base:"${HEAD_SHA}" "${BACKEND_BASE_TAG_REF}"
|
||||
docker push "${BACKEND_BASE_TAG_REF}"
|
||||
docker pull "${BACKEND_BASE_TAG_REF}" >/dev/null
|
||||
retry_registry_op push "${BACKEND_BASE_TAG_REF}" 5 4
|
||||
retry_registry_op pull "${BACKEND_BASE_TAG_REF}" 5 3
|
||||
|
||||
BACKEND_BASE_DIGEST_REF="$({ docker image inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "${BACKEND_BASE_TAG_REF}" | grep "^${BACKEND_BASE_REPO}@sha256:" | head -n 1; } || true)"
|
||||
if [ -z "${BACKEND_BASE_DIGEST_REF}" ]; then
|
||||
@@ -693,14 +723,44 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
retry_registry_op() {
|
||||
op_name="$1"
|
||||
image_ref="$2"
|
||||
attempts="${3:-5}"
|
||||
backoff="${4:-3}"
|
||||
attempt=1
|
||||
|
||||
while [ "${attempt}" -le "${attempts}" ]; do
|
||||
echo "${op_name} attempt ${attempt}/${attempts} for ${image_ref}"
|
||||
if [ "${op_name}" = "push" ]; then
|
||||
if docker push "${image_ref}"; then
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
if docker pull "${image_ref}" >/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${attempt}" -lt "${attempts}" ]; then
|
||||
sleep_seconds=$((backoff * attempt))
|
||||
echo "Retrying in ${sleep_seconds}s"
|
||||
sleep "${sleep_seconds}"
|
||||
fi
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "${PACKAGE_ACCESS_TOKEN}" | docker login "http://${GITEA_REGISTRY}" -u "${REGISTRY_USER}" --password-stdin
|
||||
FRONTEND_BASE_REPO="${GITEA_REGISTRY}/darkhelm.org/plex-playlist-frontend-base"
|
||||
FRONTEND_BASE_TAG_REF="${FRONTEND_BASE_REPO}:${HEAD_SHA}"
|
||||
|
||||
docker build -f Dockerfile.frontend --target deps -t plex-playlist-frontend-base:"${HEAD_SHA}" .
|
||||
docker tag plex-playlist-frontend-base:"${HEAD_SHA}" "${FRONTEND_BASE_TAG_REF}"
|
||||
docker push "${FRONTEND_BASE_TAG_REF}"
|
||||
docker pull "${FRONTEND_BASE_TAG_REF}" >/dev/null
|
||||
retry_registry_op push "${FRONTEND_BASE_TAG_REF}" 5 4
|
||||
retry_registry_op pull "${FRONTEND_BASE_TAG_REF}" 5 3
|
||||
|
||||
FRONTEND_BASE_DIGEST_REF="$({ docker image inspect --format '{{range .RepoDigests}}{{println .}}{{end}}' "${FRONTEND_BASE_TAG_REF}" | grep "^${FRONTEND_BASE_REPO}@sha256:" | head -n 1; } || true)"
|
||||
if [ -z "${FRONTEND_BASE_DIGEST_REF}" ]; then
|
||||
|
||||
Reference in New Issue
Block a user