Preserve rollback image on repeated deploys
GeoIntel CI / docs-smoke (push) Canceled after 0s
GeoIntel CI / contract-smoke (push) Canceled after 0s

This commit is contained in:
Codex
2026-07-18 02:37:54 +02:00
parent f7078468db
commit 851d0ef109
3 changed files with 15 additions and 1 deletions
+2
View File
@@ -75,6 +75,8 @@
- Bound immutable release tags to both commit and dependency profile
(`<sha>-ai` or `<sha>-gis`) and reuse matching images instead of rebuilding
or overwriting an existing release tag.
- Preserved the actual prior rollback image across repeated no-op deploys of
the same immutable release.
- Made production startup reject known-default PostGIS passwords and apply the
configured upload limit consistently to nginx and FastAPI.
@@ -25,7 +25,10 @@ def test_release_deploy_preserves_immutable_and_previous_images() -> None:
assert 'GEOINTEL_RELEASE_VARIANT="gis"' in script
assert 'GEOINTEL_RELEASE_IMAGE="${GEOINTEL_IMAGE_REPOSITORY}:${GEOINTEL_BUILD_SHA}-${GEOINTEL_RELEASE_VARIANT}"' in script
assert 'GEOINTEL_PREVIOUS_IMAGE="${GEOINTEL_IMAGE_REPOSITORY}:previous"' in script
assert 'release_image_id="$(' in script
assert '[ "$current_image_id" != "$release_image_id" ]' in script
assert 'docker tag "$current_image_id" "$GEOINTEL_PREVIOUS_IMAGE"' in script
assert "preserving the existing previous image" in script
assert 'if docker image inspect "$GEOINTEL_RELEASE_IMAGE"' in script
assert "Immutable release tag has conflicting metadata" in script
assert "Reusing existing immutable image" in script
+10 -1
View File
@@ -66,8 +66,17 @@ rollback_previous() {
docker compose -f docker-compose.unraid.yml config >/dev/null
current_image_id="$(docker inspect --format '{{.Image}}' geointel 2>/dev/null || true)"
if [ -n "$current_image_id" ] && docker image inspect "$current_image_id" >/dev/null 2>&1; then
release_image_id="$(
docker image inspect --format '{{.Id}}' "$GEOINTEL_RELEASE_IMAGE" 2>/dev/null || true
)"
if (
[ -n "$current_image_id" ] &&
[ "$current_image_id" != "$release_image_id" ] &&
docker image inspect "$current_image_id" >/dev/null 2>&1
); then
docker tag "$current_image_id" "$GEOINTEL_PREVIOUS_IMAGE"
elif [ -n "$current_image_id" ] && [ "$current_image_id" = "$release_image_id" ]; then
echo "Current container already uses ${GEOINTEL_RELEASE_IMAGE}; preserving the existing previous image."
fi
if docker image inspect "$GEOINTEL_RELEASE_IMAGE" >/dev/null 2>&1; then