A deployment should run the exact artifact approved for release. Build it once, record the source and job that produced it, approve its digest, and check that digest again immediately before it starts. Separate release authorization from application authorship so an author can't approve and deploy an arbitrary replacement.
The example below builds a small Python application in a private GitLab project, signs the release decision, and runs the approved bytes in a local Docker container. Two versions, A and B, make both deployment and rollback visible. This build doesn't consume the scanner-profile or DAP review results and doesn't establish a security-verification gate; the signature binds the operator's decision to particular bytes.
The container has no published ports and uses --network none. The example lets you work through digest checking and separate deployment authority. Its local key and shared Docker host aren't a production design; production traffic switching, signing-key custody, and SLSA provenance require additional controls.
| Standard example control | Implementation steps |
|---|---|
| Provenance and signing | Acquire the exact build and sign its release decision. The local signing example is not full SLSA provenance. |
| Verify before deploy | Deploy approved A and reject altered bytes or signers. |
| Immutable references | Carry the artifact digest through deployment and rollback. For a registry, also configure tag protection and overwrite restrictions; the local example doesn't configure them. |
Set application and release permissions
Use a fresh private release project initialized with a README so its default main branch and initial SHA exist before this procedure begins:
- A project Owner protects
main, reviews the build configuration and source, and supplies Owner-only configuration reads. - The application actor remains a Maintainer in the application project but receives only Developer access to this release project. Use that account to confirm that application access does not grant deployment permission.
- For connected response, a release service account receives Developer access to this release project and is the sole deployer for
local-release-lab. A trusted human release operator controls its short-lived credential and the local Docker host. - For a standalone release, an authorized human can receive Developer access and be selected as the sole deployer instead. Choose this identity during permission setup; don't add it later alongside the service account.
Under Settings > Repository > Branch rules, protect main. Allow push, merge, and unprotect only for the named Owner, disable force push, and inspect every matching rule because matching permissions are additive. See protected branches and the Protected branches API.
Under Settings > CI/CD:
- Set the minimum role allowed to use pipeline variables to No one allowed.
- Keep job-token repository pushes disabled.
- Confirm the project can use an online GitLab-hosted Linux AMD64 runner carrying
saas-linux-small-amd64. - Inspect project and ancestor variable metadata. Resolve any inherited build override or credential before continuing; do not export variable values into the release record.
Create an environment named local-release-lab with tier testing. Protect it and allow deployment only by the configured release deployer: the service account for connected response or the authorized human for a standalone release. The Environments REST field is tier; deployment_tier is the CI keyword. See environments, protected environments, and the Environments API.
Whenever the configured deployer's project membership changes, check protected-environment access again. Re-inviting a user doesn't restore a removed user-specific deploy permission, so add that same user to the protected environment again before resuming deployment.
Before adding source, read back the direct and effective memberships, branch rule, project settings, environment, protected-environment rule, runner eligibility, policies, and variable metadata. Record the project ID/path, three user IDs, environment ID, and initial main SHA. These values anchor the later build, authorization, and deployment checks to the project you configured.
Prepare the workstation and sample application
First get the example files. That setup defines GSS_GUIDE_CHECKOUT as the absolute directory containing chapters/01-prepare.md and examples. Keep it separate from the private release-project clone. The workstation commands use release_driver.py, release_tools.py, and docker_runtime.py from that reviewed guide checkout. Keep the driver and Docker helper out of the private build project.
Check the workstation before creating any release state. You need Python 3.12 or later, OpenSSL 3, jq, glab, and Docker Desktop with the desktop-linux context. The build job runs on a Linux AMD64 runner; the local example runtime is ARM64 and uses a pinned image referenced by the example, not included in the downloaded files. Follow Prepare the Python runtime to load and verify that exact image before continuing. Stop before any release operation if a prerequisite differs:
set -euo pipefail
python3 --version
python3 -c 'import sys; sys.exit(0 if sys.version_info >= (3, 12) else "Python 3.12 or later is required")'
openssl version | grep -E '^OpenSSL 3\.'
jq --version
glab --version
docker --context desktop-linux version
docker --context desktop-linux image inspect \
'python@sha256:f77ac9e44ae96ef2c90b8053ea08c31f8be030f824196b0ae4db6d462c84e51f' \
>/dev/null
test -f "$GSS_GUIDE_CHECKOUT/chapters/01-prepare.md"
test -d "$GSS_GUIDE_CHECKOUT/examples"
export GSS_DRIVER="$GSS_GUIDE_CHECKOUT/examples/connected-release/release_driver.py"
export GSS_TOOLS="$GSS_GUIDE_CHECKOUT/examples/connected-release/release_tools.py"
export GSS_PROJECT_ID='<private-release-project-id>'
export GSS_PROJECT_PATH='<namespace/private-release-project>'
export GSS_RELEASE_CHECKOUT='<absolute-path-for-private-release-project-clone>'
export GSS_INITIAL_MAIN_SHA='<recorded-initial-main-sha>'
export GSS_OWNER_ID='<trusted-owner-user-id>'
export GSS_ACTOR_ID='<application-actor-user-id>'
export GSS_RELEASE_OPERATOR_ID='<configured-release-deployer-user-id>'
export GSS_ENVIRONMENT_ID='<local-release-lab-environment-id>'
export GSS_RECORD_DIR='<absolute-path-outside-both-checkouts-for-release-records>'
[[ "$GSS_GUIDE_CHECKOUT" = /* && "$GSS_RELEASE_CHECKOUT" = /* && "$GSS_RECORD_DIR" = /* ]]
GSS_RELEASE_CHECKOUT="$(python3 -c 'import os,sys; print(os.path.realpath(sys.argv[1]))' "$GSS_RELEASE_CHECKOUT")"
GSS_RECORD_DIR="$(python3 -c 'import os,sys; print(os.path.realpath(sys.argv[1]))' "$GSS_RECORD_DIR")"
python3 - <<'PY'
import os
from pathlib import Path
guide = Path(os.environ['GSS_GUIDE_CHECKOUT']).resolve()
release = Path(os.environ['GSS_RELEASE_CHECKOUT']).resolve()
record = Path(os.environ['GSS_RECORD_DIR']).resolve()
if guide == release or guide in release.parents or release in guide.parents:
raise SystemExit('Guide files and release clone need separate directories')
if any(record == checkout or checkout in record.parents for checkout in (guide, release)):
raise SystemExit('Release records must be outside both checkouts')
PY
test ! -e "$GSS_RELEASE_CHECKOUT"
test ! -e "$GSS_RECORD_DIR"
install -d -m 700 "$GSS_RECORD_DIR" "$GSS_RECORD_DIR/keys"
In the trusted Owner's glab session, require the configured account and project to match the IDs recorded during permission setup. Read the project's SSH clone URL from that authenticated numeric project lookup. The Owner's SSH key must already authenticate to gitlab.com as the same Owner with permission to push protected main. Clone that exact URL into the separate absolute path, select main, and require the recorded initial SHA, exact repository root and origin, and an empty worktree:
test "$(glab api --hostname gitlab.com user | jq -er '.id')" = "$GSS_OWNER_ID"
GSS_RELEASE_PROJECT="$(glab api --hostname gitlab.com \
"projects/$GSS_PROJECT_ID")"
test "$(jq -er '.path_with_namespace' <<<"$GSS_RELEASE_PROJECT")" \
= "$GSS_PROJECT_PATH"
export GSS_RELEASE_REMOTE_URL="$(jq -er '.ssh_url_to_repo' \
<<<"$GSS_RELEASE_PROJECT")"
test ! -e "$GSS_RELEASE_CHECKOUT"
git clone "$GSS_RELEASE_REMOTE_URL" "$GSS_RELEASE_CHECKOUT"
cd "$GSS_RELEASE_CHECKOUT"
test "$(git rev-parse --show-toplevel)" = "$GSS_RELEASE_CHECKOUT"
test "$(git remote get-url origin)" = "$GSS_RELEASE_REMOTE_URL"
test -z "$(git status --short)"
git fetch origin main
git switch main
test "$(git rev-parse HEAD)" = "$GSS_INITIAL_MAIN_SHA"
test "$(git rev-parse origin/main)" = "$GSS_INITIAL_MAIN_SHA"
Copy these reviewed files from the guide checkout to the release-project root, inspect the staged source, and commit and push them through the Owner path:
cp "$GSS_GUIDE_CHECKOUT/examples/connected-release/.gitlab-ci.yml" .gitlab-ci.yml
cp "$GSS_GUIDE_CHECKOUT/examples/connected-release/build_fixture.py" build_fixture.py
cp "$GSS_GUIDE_CHECKOUT/examples/connected-release/release_tools.py" release_tools.py
cp "$GSS_GUIDE_CHECKOUT/examples/connected-release/version.txt" version.txt
git diff --check
git diff
git add .gitlab-ci.yml build_fixture.py release_tools.py version.txt
git diff --cached --check
git diff --cached
git commit -m 'Add connected release fixture'
export GSS_A_SHA="$(git rev-parse HEAD)"
git push origin HEAD:main
test "$(git ls-remote origin refs/heads/main | awk '{print $1}')" = "$GSS_A_SHA"
test -z "$(git status --short)"
Build A uses known-good-a. Its default-branch push pipeline must have exactly one successful build_release_fixture job, which publishes dist/release.pyz and dist/build-manifest.json. This gives the operator one unambiguous build to acquire.
Use short-lived API credentials for the operator actions. If you plan to follow the connected response procedure, use the group service account selected as the deployer during permission setup. The trusted human operator acts through that service account; the service-account user ID remains the sole protected-environment deployer. The trusted group Owner creates its personal access token through the service accounts API. Record the owning group ID, service-account user ID, token ID, scope, and expiry so a responder can revoke that exact token and issue a replacement for the same account without adding another deployer. For a standalone release, select the authorized human as the sole deployer during permission setup, use that person's personal access token, and revoke it through that identity's token settings. Enter tokens at the driver's hidden prompt or expose them only to that process through the named environment variables. Keep their values out of command arguments and shell history.
Select and acquire exact build A
Start by recording A's full source SHA, pipeline ID, and job ID from GitLab. Before acquiring anything, confirm that the pipeline is a successful push on the default branch and that the job succeeded. The driver first uses each held credential to read /user and requires its numeric ID to match the recorded Owner or release-operator ID. A mismatch, authentication failure, or transport failure stops before the acquisition directory is created or any release resource is read. It then repeats the build checks through authenticated APIs, reads the actual runner details, downloads the exact job archive, extracts only the two expected artifacts, retrieves each exact source file with its response identity, and writes operator-inputs.json as the input record for the remaining steps. The receipt and journal retain the confirmed numeric IDs, not credential values or full user profiles:
# GSS_A_SHA is the full SHA pushed during sample initialization.
export GSS_A_PIPELINE_ID='<a-pipeline-id>'
export GSS_A_JOB_ID='<a-job-id>'
python3 "$GSS_DRIVER" acquire \
--project-id "$GSS_PROJECT_ID" --project-path "$GSS_PROJECT_PATH" \
--owner-id "$GSS_OWNER_ID" --operator-id "$GSS_RELEASE_OPERATOR_ID" \
--source-sha "$GSS_A_SHA" --pipeline-id "$GSS_A_PIPELINE_ID" \
--job-id "$GSS_A_JOB_ID" --job-name build_release_fixture \
--version known-good-a --output-dir "$GSS_RECORD_DIR/a" \
--owner-token-env GITLAB_OWNER_TOKEN \
--operator-token-env GITLAB_OPERATOR_TOKEN \
--journal "$GSS_RECORD_DIR/acquire-a.jsonl"
The driver creates the directory once with mode 0700. Don't reuse it after a partial acquisition, because that could mix records from separate attempts. Retain the complete job archive along with the extracted artifact, manifest, source files, input record, and journal. The Jobs API, Pipelines API, Repository files API, Runners API, and Job artifacts API define the values the driver observes.
Create the release identity and sign A
The signature needs a trust reference that doesn't come from the material being verified. Generate an exercise-only Ed25519 key and record its reported fingerprint through the release-approval channel before signing. The trusted fingerprint must not come from the artifact or signature being checked.
Create the release key and record its fingerprint
python3 "$GSS_TOOLS" keygen \
--private-key "$GSS_RECORD_DIR/keys/release-private.pem" \
--public-key "$GSS_RECORD_DIR/keys/release-public.pem" \
| tee "$GSS_RECORD_DIR/keygen.json"
export GSS_TRUSTED_FINGERPRINT="$(jq -er '.fingerprint_sha256' "$GSS_RECORD_DIR/keygen.json")"
Sign the promotion and define verification
Promote A using the exact identities in operator-inputs.json:
promote() {
inputs="$1"; release_id="$2"; output="$3"; signature="$4"
private_key="${5:-$GSS_RECORD_DIR/keys/release-private.pem}"
public_key="${6:-$GSS_RECORD_DIR/keys/release-public.pem}"
python3 "$GSS_TOOLS" promote \
--manifest "$(jq -er '.paths.manifest' "$inputs")" \
--artifact "$(jq -er '.paths.artifact' "$inputs")" \
--private-key "$private_key" --public-key "$public_key" \
--release-id "$release_id" \
--project-id "$(jq -er '.project.id' "$inputs")" \
--project-path "$(jq -er '.project.path' "$inputs")" \
--source-sha "$(jq -er '.source_sha' "$inputs")" \
--pipeline-id "$(jq -er '.pipeline.id' "$inputs")" \
--pipeline-source "$(jq -er '.pipeline.source' "$inputs")" \
--ref "$(jq -er '.pipeline.ref' "$inputs")" \
--job-id "$(jq -er '.job.id' "$inputs")" \
--job-name "$(jq -er '.job.name' "$inputs")" \
--runner-id "$(jq -er '.runner.id' "$inputs")" \
--version "$(jq -er '.version' "$inputs")" \
--builder "$(jq -er '.paths.builder' "$inputs")" \
--ci-file "$(jq -er '.paths.ci' "$inputs")" \
--version-file "$(jq -er '.paths.version' "$inputs")" \
--output "$output" --signature "$signature"
}
promote "$GSS_RECORD_DIR/a/operator-inputs.json" initial-a \
"$GSS_RECORD_DIR/a/promotion.json" "$GSS_RECORD_DIR/a/promotion.sig"
Define the matching verifier once so the normal deployment and rejection checks use the same verification path. Its optional arguments let the rejection checks substitute only the byte or key under test:
verify_release() {
inputs="$1"; release_id="$2"; attestation="$3"; signature="$4"
artifact="${5:-$(jq -er '.paths.artifact' "$inputs")}"
public_key="${6:-$GSS_RECORD_DIR/keys/release-public.pem}"
fingerprint="${7:-$GSS_TRUSTED_FINGERPRINT}"
python3 "$GSS_TOOLS" verify \
--manifest "$(jq -er '.paths.manifest' "$inputs")" --artifact "$artifact" \
--attestation "$attestation" --signature "$signature" --public-key "$public_key" \
--trusted-fingerprint "$fingerprint" --release-id "$release_id" \
--project-id "$(jq -er '.project.id' "$inputs")" \
--project-path "$(jq -er '.project.path' "$inputs")" \
--source-sha "$(jq -er '.source_sha' "$inputs")" \
--pipeline-id "$(jq -er '.pipeline.id' "$inputs")" \
--pipeline-source "$(jq -er '.pipeline.source' "$inputs")" \
--ref "$(jq -er '.pipeline.ref' "$inputs")" \
--job-id "$(jq -er '.job.id' "$inputs")" \
--job-name "$(jq -er '.job.name' "$inputs")" \
--runner-id "$(jq -er '.runner.id' "$inputs")" \
--version "$(jq -er '.version' "$inputs")" \
--builder "$(jq -er '.paths.builder' "$inputs")" \
--ci-file "$(jq -er '.paths.ci' "$inputs")" \
--version-file "$(jq -er '.paths.version' "$inputs")"
}
Prove authority and deploy A
Before the operator's first deployment, check the separation of authority. The application actor should be able to read its own identity and this release project, but it must not be able to create a protected deployment. The driver attempts one running deployment, accepts only an authorization denial, reads the actor identity again, and requires the deployment-ID inventory to remain unchanged:
python3 "$GSS_DRIVER" deny-deployment \
--project-id "$GSS_PROJECT_ID" --actor-id "$GSS_ACTOR_ID" \
--source-sha "$GSS_A_SHA" --ref main --environment local-release-lab \
--actor-token-env GITLAB_ACTOR_TOKEN \
--journal "$GSS_RECORD_DIR/actor-denial.jsonl"
A timeout leaves the outcome unknown; it isn't an authorization denial. Stop and reconcile the deployment inventory before continuing. Don't repeat a write whose result is uncertain.
With the authority check complete, deploy A in one process. The driver first requires the held operator credential's /user ID to equal GSS_RELEASE_OPERATOR_ID; failure stops before receipt reservation, a GitLab deployment write, or a Docker command. It then revalidates all acquired bytes and the promotion, creates the GitLab deployment as running, verifies again immediately before changing Docker, starts and checkpoints the restricted container, proves its mounted digest, health, and version, updates that exact deployment to success, and reads it back:
Deploy approved A
python3 "$GSS_DRIVER" deploy \
--operator-id "$GSS_RELEASE_OPERATOR_ID" \
--inputs "$GSS_RECORD_DIR/a/operator-inputs.json" \
--attestation "$GSS_RECORD_DIR/a/promotion.json" \
--signature "$GSS_RECORD_DIR/a/promotion.sig" \
--public-key "$GSS_RECORD_DIR/keys/release-public.pem" \
--trusted-fingerprint "$GSS_TRUSTED_FINGERPRINT" \
--release-id initial-a --environment local-release-lab \
--receipt "$GSS_RECORD_DIR/a/runtime.json" \
--operator-token-env GITLAB_OPERATOR_TOKEN \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/deploy-a.jsonl"
Build and deploy B
Version B shows that the same controls still hold when the application changes. Have the Owner change only version.txt from known-good-a to candidate-b. Review the diff, commit it to protected main, and require a successful default-branch push pipeline and successful build_release_fixture job. Acquire B into a new directory with the same acquire command, substituting B's exact SHA, pipeline ID, job ID, --version candidate-b, output directory b, and a new journal.
Promote B with a distinct release ID:
promote "$GSS_RECORD_DIR/b/operator-inputs.json" candidate-b \
"$GSS_RECORD_DIR/b/promotion.json" "$GSS_RECORD_DIR/b/promotion.sig"
This exercise uses stop-then-start replacement. Inspect A one last time so you know what is running, remove it by its exact receipt, and then deploy B:
python3 "$GSS_DRIVER" inspect-runtime --receipt "$GSS_RECORD_DIR/a/runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/inspect-a.jsonl"
python3 "$GSS_DRIVER" remove-runtime --receipt "$GSS_RECORD_DIR/a/runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/remove-a.jsonl"
python3 "$GSS_DRIVER" deploy \
--operator-id "$GSS_RELEASE_OPERATOR_ID" \
--inputs "$GSS_RECORD_DIR/b/operator-inputs.json" \
--attestation "$GSS_RECORD_DIR/b/promotion.json" \
--signature "$GSS_RECORD_DIR/b/promotion.sig" \
--public-key "$GSS_RECORD_DIR/keys/release-public.pem" \
--trusted-fingerprint "$GSS_TRUSTED_FINGERPRINT" \
--release-id candidate-b --environment local-release-lab \
--receipt "$GSS_RECORD_DIR/b/runtime.json" \
--operator-token-env GITLAB_OPERATOR_TOKEN \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/deploy-b.jsonl"
There is an interruption between A and B. This sequence doesn't provide blue-green deployment or traffic switching.
Reject altered bytes and an unapproved signer
Now check that approval can't be carried over to different bytes. Copy and alter B's artifact, require the same verifier to reject it before any deployment or Docker command, and then inspect B's unchanged receipt:
install -m 600 "$(jq -er '.paths.artifact' "$GSS_RECORD_DIR/b/operator-inputs.json")" \
"$GSS_RECORD_DIR/b/altered-release.pyz"
printf tampered >> "$GSS_RECORD_DIR/b/altered-release.pyz"
if verify_release "$GSS_RECORD_DIR/b/operator-inputs.json" candidate-b \
"$GSS_RECORD_DIR/b/promotion.json" "$GSS_RECORD_DIR/b/promotion.sig" \
"$GSS_RECORD_DIR/b/altered-release.pyz" \
2>"$GSS_RECORD_DIR/b/altered-rejection.txt"; then
echo 'altered artifact was accepted' >&2; exit 1
fi
grep -F 'ContractError: build manifest differs from verified inputs or artifact' \
"$GSS_RECORD_DIR/b/altered-rejection.txt"
python3 "$GSS_DRIVER" inspect-runtime --receipt "$GSS_RECORD_DIR/b/runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/inspect-b-after-alteration.jsonl"
Next, check the signer. Create a second Ed25519 key and a valid promotion for unchanged B using that key. Verification must reject its unapproved fingerprint while B remains healthy:
install -d -m 700 "$GSS_RECORD_DIR/unapproved-key"
python3 "$GSS_TOOLS" keygen \
--private-key "$GSS_RECORD_DIR/unapproved-key/private.pem" \
--public-key "$GSS_RECORD_DIR/unapproved-key/public.pem" \
>"$GSS_RECORD_DIR/unapproved-key/keygen.json"
promote "$GSS_RECORD_DIR/b/operator-inputs.json" unapproved-b \
"$GSS_RECORD_DIR/b/unapproved.json" "$GSS_RECORD_DIR/b/unapproved.sig" \
"$GSS_RECORD_DIR/unapproved-key/private.pem" "$GSS_RECORD_DIR/unapproved-key/public.pem"
if verify_release "$GSS_RECORD_DIR/b/operator-inputs.json" unapproved-b \
"$GSS_RECORD_DIR/b/unapproved.json" "$GSS_RECORD_DIR/b/unapproved.sig" \
"$(jq -er '.paths.artifact' "$GSS_RECORD_DIR/b/operator-inputs.json")" \
"$GSS_RECORD_DIR/unapproved-key/public.pem" "$GSS_TRUSTED_FINGERPRINT" \
2>"$GSS_RECORD_DIR/b/unapproved-signer-rejection.txt"; then
echo 'unapproved signer was accepted' >&2; exit 1
fi
grep -F 'ContractError: public key does not match the trusted release fingerprint' \
"$GSS_RECORD_DIR/b/unapproved-signer-rejection.txt"
python3 "$GSS_DRIVER" inspect-runtime --receipt "$GSS_RECORD_DIR/b/runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/inspect-b-after-signer.jsonl"
Keep both tests local: neither rejected case invokes deploy. Retain the verifier errors, the proofs that B's runtime remained unchanged, and the second public key and fingerprint.
At this point, you can practise incident response or continue with the ordinary rollback. For response practice, follow Cancel work, close its credential, and restore a verified release. Leave B running and retain its release records and current operator identity; that procedure performs its own recovery and cleanup. Otherwise, continue below.
Roll back with a new signed decision
A rollback is a new release decision, even when it returns to retained bytes. Create a distinct rollback promotion over A; do not reuse initial-a as the rollback authorization:
promote "$GSS_RECORD_DIR/a/operator-inputs.json" rollback-a \
"$GSS_RECORD_DIR/a/rollback.json" "$GSS_RECORD_DIR/a/rollback.sig"
python3 "$GSS_DRIVER" inspect-runtime --receipt "$GSS_RECORD_DIR/b/runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/inspect-b.jsonl"
python3 "$GSS_DRIVER" remove-runtime --receipt "$GSS_RECORD_DIR/b/runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/remove-b.jsonl"
python3 "$GSS_DRIVER" deploy \
--operator-id "$GSS_RELEASE_OPERATOR_ID" \
--inputs "$GSS_RECORD_DIR/a/operator-inputs.json" \
--attestation "$GSS_RECORD_DIR/a/rollback.json" \
--signature "$GSS_RECORD_DIR/a/rollback.sig" \
--public-key "$GSS_RECORD_DIR/keys/release-public.pem" \
--trusted-fingerprint "$GSS_TRUSTED_FINGERPRINT" \
--release-id rollback-a --environment local-release-lab \
--receipt "$GSS_RECORD_DIR/a/rollback-runtime.json" \
--operator-token-env GITLAB_OPERATOR_TOKEN \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/deploy-rollback.jsonl"
The rollback starts a new container from the retained A bytes and creates a new deployment record. It doesn't rebuild A or rewrite B's deployment history.
Close the exercise
Finish by inspecting and removing the rollback runtime. Then stop the exact environment and require its stopped readback:
python3 "$GSS_DRIVER" inspect-runtime \
--receipt "$GSS_RECORD_DIR/a/rollback-runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/inspect-rollback.jsonl"
python3 "$GSS_DRIVER" remove-runtime \
--receipt "$GSS_RECORD_DIR/a/rollback-runtime.json" \
--docker-context desktop-linux --journal "$GSS_RECORD_DIR/remove-rollback.jsonl"
python3 "$GSS_DRIVER" stop-environment \
--project-id "$GSS_PROJECT_ID" --environment-id "$GSS_ENVIRONMENT_ID" \
--operator-id "$GSS_RELEASE_OPERATOR_ID" \
--environment local-release-lab \
--operator-token-env GITLAB_OPERATOR_TOKEN \
--journal "$GSS_RECORD_DIR/stop-environment.jsonl"
The stop command checks the held operator credential against the same recorded numeric ID before reading or changing the environment. A different user, rejected credential, or unknown transport result stops without attempting the environment mutation.
Revoke every temporary token through the identity or Owner interface that created it. Record each token ID and require an inactive or revoked readback; unsetting a shell variable doesn't close a credential. Remove the two temporary direct Developer memberships, then read the direct and effective membership again. Destroy the exercise private keys under the organization's key-destruction procedure, retaining public keys and fingerprints when the release record requires them.
Keep the source, build, signed approval, and deployment records together. An operator should be able to identify the artifact that ran and select a retained version for recovery. Protect the public keys and approval records from unauthorized changes, apply your retention policy to downloaded artifacts and logs, and record which temporary credentials and resources were removed.
GitLab deployment records help operators find releases, but they remain mutable metadata. Use the signed approval and the running artifact to decide whether the intended software reached the environment.