Files
vpn-dns-gateway/delivery/ci/publish.sh
T
vsun1 bf28adc7fb
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good
Prepare Assignment 8 secure delivery and rollback
Add the locked pricing service, trusted-agent pipeline, Ansible deployments, security gates, recovery runbooks, prerequisite evidence, and preparation manual.

Prepared with Codex assistance. Vincent explicitly authorized this local commit and will handle the push. Assessed releases and recovery exercises remain pending.
2026-11-14 17:09:25 -05:00

31 lines
1.4 KiB
Bash

#!/bin/sh
set -eu
set +x
: "${REGISTRY_USER:?bind registry credentials}"
: "${REGISTRY_TOKEN:?bind registry credentials}"
image=git.yebilly.me/ssw590-group1/pricing
commit=$(git rev-parse HEAD)
reports=build/delivery/reports
mkdir -p "$reports" build/delivery/releases
export DOCKER_CONFIG
DOCKER_CONFIG=$(mktemp -d)
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
printf '%s' "$REGISTRY_TOKEN" | docker login --username "$REGISTRY_USER" --password-stdin git.yebilly.me
# Never overwrite a source-commit tag during a retry.
if docker manifest inspect "$image:$commit" > "$reports/existing-manifest.json" 2> "$reports/manifest-check.log"; then
docker pull "$image:$commit"
else
if ! grep -Eqi 'manifest unknown|no such manifest|not found' "$reports/manifest-check.log"; then
cat "$reports/manifest-check.log" >&2
exit 1
fi
docker build --platform linux/amd64 --build-arg "APP_COMMIT=$commit" -t "$image:$commit" delivery/app
python3 delivery/ci/security.py image --image "$image:$commit" --reports "$reports/image-gate"
docker push "$image:$commit"
docker pull "$image:$commit"
fi
digest=$(docker image inspect "$image:$commit" --format '{{index .RepoDigests 0}}')
python3 delivery/ci/security.py image --image "$digest" --reports "$reports/published-image-gate"
printf '%s\n' "$digest" > "$reports/published-digest.txt"
python3 delivery/ci/release.py create --image "$digest" --build-url "$BUILD_URL" --output build/delivery/releases