feat(deploy): add release manifest with pinned base image digests

This commit is contained in:
shira committed 2026-10-06 15:43:03 +03:00
1 parent ea0982a762
commit a0551a34b8
18 files changed
+2316 -21

No files matched your search

+27 -4
View File
@@ -9,11 +9,25 @@
# Optional environment:
# E2E_SPEC_DIR directory with specs to run instead of frontend/e2e, for
# example a scratch copy while debugging the suite.
# LINCODEX_RELEASE_TAG run against the release images of this tag (built
# by make -C deploy release-build) without building or pulling,
# keep those images, and record passing evidence for the
# release manifest. Specs must be the committed frontend/e2e.
# Only make -C deploy release-e2e sets it.
set -euo pipefail
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
compose_file="$root/deploy/docker/docker-compose.yml"
e2e_file="$root/deploy/docker/docker-compose.e2e.yml"
release_file="$root/deploy/docker/docker-compose.release.yml"
release_script="$root/deploy/scripts/release_manifest.py"
release_tag="${LINCODEX_RELEASE_TAG:-}"
compose_files=(-f "$compose_file" -f "$e2e_file")
up_args=(--build)
if [[ -n "$release_tag" ]]; then
compose_files+=(-f "$release_file")
up_args=(--no-build --pull never)
fi
frontend_dir="$root/frontend"
artifacts_dir="$frontend_dir/test-results/e2e"
spec_dir="${E2E_SPEC_DIR:-$frontend_dir/e2e}"
@@ -46,6 +60,9 @@ installed=$(sed -n 's/^ *"version": "\([^"]*\)",\{0,1\}$/\1/p' "$installed_manif
fail "Installed @playwright/test $installed differs from $declared. Run make -C frontend install."
[[ -d "$spec_dir" ]] || fail "Spec directory $spec_dir does not exist."
spec_dir=$(cd "$spec_dir" && pwd)
if [[ -n "$release_tag" && "$spec_dir" != "$frontend_dir/e2e" ]]; then
fail 'Release evidence needs the committed suite; unset E2E_SPEC_DIR.'
fi
for dockerfile in "$root/backend/Dockerfile" "$root/frontend/Dockerfile"; do
[[ -f "$dockerfile" ]] || fail "Missing required build file $dockerfile."
done
@@ -65,12 +82,11 @@ compose() {
APP_PROJECT="$project" APP_NETWORK="$network" APP_STORAGE_NETWORK="$storage_network" \
PLAYWRIGHT_VERSION="$declared" E2E_CI="${CI:-}" \
E2E_UID="$(id -u)" E2E_GID="$(id -g)" \
E2E_SPEC_DIR="$spec_dir" E2E_ARTIFACTS_DIR="$artifacts_dir" \
E2E_SPEC_DIR="$spec_dir" E2E_ARTIFACTS_DIR="$artifacts_dir" LINCODEX_RELEASE_TAG="$release_tag" \
docker compose \
--env-file "$env_file" \
-p "$project" \
-f "$compose_file" \
-f "$e2e_file" \
"${compose_files[@]}" \
"$@"
}
@@ -87,6 +103,9 @@ done
if [[ -n "$(docker ps -aq --filter "label=com.docker.compose.project=$project")" ]]; then
fail "Refusing to use existing Compose project $project."
fi
if [[ -n "$release_tag" ]]; then
PYTHONDONTWRITEBYTECODE=1 python3 "$release_script" require-images --tag "$release_tag"
fi
cleanup() {
local result=$?
@@ -138,7 +157,7 @@ printf 'E2E project: %s (Playwright %s)\n' "$project" "$declared"
compose config --quiet
compose --profile e2e config --quiet
started=1
compose up --build -d --wait --wait-timeout 180
compose up "${up_args[@]}" -d --wait --wait-timeout 180
# The backend has no Compose health check; wait until it reports PostgreSQL,
# Redis, and SeaweedFS ready before the browser starts.
@@ -162,5 +181,9 @@ set -e
if ((status != 0)); then
printf 'Playwright failed with exit code %s; traces and screenshots are in %s/results.\n' \
"$status" "$artifacts_dir" >&2
elif [[ -n "$release_tag" ]]; then
# The suite passed; bind the result to the image IDs that ran.
PYTHONDONTWRITEBYTECODE=1 python3 "$release_script" record-evidence --check e2e --project "$project" \
--tag "$release_tag" --tool-image "playwright=mcr.microsoft.com/playwright:v$declared-noble"
fi
exit "$status"