Skip to content

fix(release): publish the Service image from its release branch, so main never pins a missing image - #1452

Merged
dan-petty merged 1 commit into
release/v0.2.29from
fix/1451-image-before-main-pins-it
Oct 8, 2026
Merged

dan-petty merged 1 commit into
release/v0.2.29from
fix/1451-image-before-main-pins-it

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Closes #1451

Summary

main pinned service:vX.Y.Z before the image existed. The cut sets newTag: vX.Y.Z in k8s/devops/kustomization.yaml, and Argo CD's devops app, which tracks main, synced about 2 minutes after the merge. But release.yml pushed the image only at the end of its run on main: v0.2.28's run went from 23:43:28 to 23:50:20. roadmap-service uses strategy: Recreate, so it was down that whole time. It stayed down whenever the release run failed, as it did for v0.2.27.

With this change, the release branch publishes the image before the merge.

  • release.yml triggers. on.push.branches gains release/v*. The release job's if already skips release branches. service-image runs when !cancelled() and either the release job succeeded or the run is a push to release/v*.
  • Image inputs. SERVICE_IMAGE_INPUTS is Dockerfile .dockerignore pyproject.toml uv.lock src .github/workflows/release.yml. The image label io.github.dan-petty.devops-cli.image-inputs holds the sha256 of git ls-tree HEAD -- those paths.
  • Provenance. The label is only its pusher's claim, so an image counts as published only when gh attestation verify passes. The plan runs it with --cert-identity-regex, which accepts only release.yml signing on refs/heads/main or refs/heads/release/vX.Y.Z.
  • New step: Plan Service Image Publication (shell: bash, GH_TOKEN). It outputs publish, promote or none. Every command whose failure decides something runs in its own assignment, so errexit and pipefail stop the step instead of a failure reading as a result.
    • On release/vX.Y.Z, it does nothing when:

      • the branch doesn't hold X.Y.Z yet (before the cut);
      • the commit is no longer the tip;
      • main already holds X.Y.Z;
      • the tag already carries these inputs and release.yml's provenance.

      It fails when the branch tip can't be read. It also fails when git merge-tree --write-tree origin/main HEAD keeps other image inputs than HEAD, because then main has image changes the branch lacks. Commits on main that leave the image alone don't count. Otherwise it publishes vX.Y.Z without latest.

    • On main, it promotes once the tag's provenance verifies. If the merged tree has other inputs, it adds a warning and the difference ships in the next release; it never replaces the tag. That covers main moving after the branch's last push, a later push, and the push that recovers a failed release run. On : not found it publishes with latest. An unverifiable image or any other registry error fails closed.

  • Push by digest, attest, then tag. The push step uses push-by-digest=true and no tags. Attestation is unchanged. Tag the Attested Service Image (shell: bash) then runs docker buildx imagetools create --tag ... on the attested digest. On a release branch it first re-checks two things:
    • a commit superseded during the build leaves the tag to the tip's run;
    • a release PR merged during the build fails the run instead of moving the tag main now pins.
  • Promote. Point latest at the Published Service Image runs imagetools create --tag service:latest service@<digest>.
  • ci.yml. Service Image skips pull requests whose head is this repository's release/v*, because release.yml's push run builds the same tree. On v0.2.28 that duplicate build cost 35.8 runner-minutes.
  • Docs. The change updates:
    • k8s/README.md step 3;
    • RELEASE_CYCLE.md: the diagram, Step 3 item 2 (with the exact chore/open-vX.Y.Z-main commands, which devops pr check-readiness exempts from grounding), critical-fix item 3 and Step 5 item 5;
    • docs/ROUTINE_TASKS.md: the diagram, which no longer has a ; that broke Mermaid parsing; step 2; step 4 (merge only with the checks green); step 5 (the verify command with --source-ref);
    • changelog.d/1451.md and the task file.

Tests

  • tests/test_release_service_image_plan.py (new) runs the plan and tag steps verbatim under bash, in a real git repo with a bare origin. The fakes are scripts on PATH:

    • docker answers imagetools inspect from a directory and records imagetools create;
    • gh checks the recorded signing identity against --cert-identity-regex;
    • one case adds git, which fails only ls-remote.

    It has 25 cases. They include a failed ls-remote in both steps, a release merged during the build, a run superseded during the build, a docs-only commit on main, three kinds of unattested image, and the recovery push after a failed release run.

  • tests/test_ci.py pins shell: bash on the plan and tag steps, and GH_TOKEN on the plan step.

  • tests/test_architectural_invariants.py keeps SERVICE_IMAGE_INPUTS in step with the Dockerfile.

  • uv run devops ci passes, and actionlint with shellcheck is clean.

After merge (a person)

  • After the v0.2.29 cut pushes release/v0.2.29:
    • The newest gh run list -R dan-petty/devops-cli --workflow release.yml --branch release/v0.2.29 --limit 3 run shows plan publish, then the push by digest, attest and tag.
    • gh attestation verify oci://ghcr.io/dan-petty/devops-cli/service:v0.2.29 -R dan-petty/devops-cli --signer-workflow dan-petty/devops-cli/.github/workflows/release.yml --source-ref refs/heads/release/v0.2.29 passes.
    • The next branch push that leaves the inputs alone (the changelog.d/ collection) logs was built and attested from these inputs already. That shows the plan's gh attestation verify works with the job's token.
  • After the release PR merges:
    • main's plan logs promote.
    • service:latest has the same digest as service:v0.2.29.
    • devops argo cd apps status devops is Synced and Healthy.
    • kubectl -n devops rollout status deploy/roadmap-service --timeout=300s succeeds, with no ImagePullBackOff.

Risks

  • The merge gate is advisory. The main ruleset requires no status checks; that belongs to fix(release): a release pull request rehearses the cut and the release job read-only, so a green pull request means the release job passes on merge #1425. A merge over a red or missing check falls back to main building the image, with today's outage until it is published.
  • A race of seconds remains. A merge between the tag step's re-check and imagetools create can still move the tag. Merging with the check green avoids it.
  • Every push to main now runs the provenance check and re-points latest. The re-point is idempotent, to the same digest.
  • Missing-tag detection depends on buildx's : not found text. If that text changes, the run fails closed; it never overwrites a tag.
  • Untagged digests build up in GHCR, about one per publish.
  • CodeQL has not run on this change. The release ruleset's code-scanning rule applies to it.

Related: #1425, #1450, #1103, #741, #753.

…ain never pins a missing image (#1451)

Each push to release/vX.Y.Z that holds X.Y.Z and changes the image's inputs
builds, smoke-tests and scans service:vX.Y.Z, pushes it by digest, attests
it and then tags it. Right before it tags, the run checks again that its
commit is the branch tip and that main doesn't hold the version, so a release
merged during the build keeps the image main pins. The branch run fails when
main has image changes the branch lacks (git merge-tree), and when the branch
tip can't be read.

On main, release.yml points latest at that image once its release.yml
provenance verifies (gh attestation verify, signed on main or the release
branch), warns when main's tree has other image inputs, never replaces a tag
main pins, and builds only when no image has the tag. ci.yml's Service Image
job skips this repository's release pull request, whose tree release.yml
already builds.
@dan-petty dan-petty added scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners scope/k8s Kubernetes commands, Helm charts, pods, services, and policies scope/release The release-please workflow, the changelog and the published artifacts type/bug Type bug: the code does not do what it must labels Oct 8, 2026
@dan-petty
dan-petty marked this pull request as ready for review October 8, 2026 20:35
@dan-petty
dan-petty merged commit 345bf4d into release/v0.2.29 Oct 8, 2026
8 checks passed
@dan-petty
dan-petty deleted the fix/1451-image-before-main-pins-it branch October 8, 2026 20:39
dan-petty added a commit that referenced this pull request Oct 8, 2026
* fix(k8s): deploy-stack applies the LLM gateway policy and narrows its egress (#795) (#1369)

* fix(cli): docs check resolves every devops argv in src (#868) (#1370)

* fix(ai): count response-cache hits as cached requests (#816) (#1378)

The client records a hit once its cached entry passes the client's check, as a cached request with no tokens or cost in the caller's stage, so the spend ledger, devops_cli_ai_requests_total{cached} and review profiles count it. Spend reports and the ledger exporter leave hits out of backend and executed-request counts, the single-point devops_cli_llm_cache_* gauges are removed, and the AI spend dashboard charts the hit share.

* fix(security): vault commands use the token `devops vault login` stores (#709) (#1377)

* fix(github): project reconcile reads an unknown quota, adds no card and reports an early stop (#892) (#1379)

* fix(k8s): deploy-stack applies the monitoring namespace perimeter (#913) (#1380)

A native deploy-stack --stack infra (or all) applies the monitoring
kustomization, perimeter and dashboards, right after the root one,
matching Argo CD's monitoring Application. A guard test fails for any
NetworkPolicy under k8s/ that deploy-stack does not apply unless an
exemption names its owner; kustomizations render with kubectl kustomize.

* chore(release): drop the llm-gateway-perimeter exemption now that #795 deploys it (#1396)

* chore(release): drop the llm-gateway-perimeter exemption now that #795 deploys it

PR #1369 (#795) and PR #1380 (#913) merged in that order. #913's guard test still exempted llm-gateway-perimeter under #795, and the test fails on a stale exemption.

* docs(release): the #795 and #913 task files record the gateway exemption's removal

* fix(roadmap): write board fields by card node id and read only that card (#1361) (#1405)

Board writes go through id-addressed gh project item-edit after one RoadmapBoardCard read, add_item returns the card item-add names, and a store reads the fields and each filter's listing once, so a job-record mark costs about 3 GraphQL points and a placement a small constant whatever the board's size. A job's write of a field someone changed since its store read the card raises RoadmapCardChangedError before any edit, and a close drops the store's listings so a cut rendered in the same round reads the board again.

* fix(release): run release pushes with the person's git environment (#1124) (#1402)

* fix(security): keep engine sockets and runtime directories out of sandbox workspaces (#1115) (#1385)

* fix(security): check the address factory HTTP clients dial, at the connect and each redirect (#898) (#1382)

* fix(github): a paginated gh api read fails closed on a page that is not the expected json (#1034) (#1406)

* fix(security): live bubblewrap tests skip condition (#1337) (#1407)

* fix(k8s): stream-framing for pod logs (#864) (#1408)

* fix(roadmap): diagnose ruleset refusals and raise typed release cut errors (#1280) (#1410)

Raise typed DevOpsCLIError subclasses for all release cut failure modes: dirty working trees (ReleaseWorkingTreeDirtyError), remote branch fetch failures (ReleaseRemoteFetchError), missing tracking refs (ReleaseBranchMissingError), ruleset push refusals (ReleasePushRefusedError), push failures (ReleasePushError), and PR creation failures (ReleasePRCreationError).

Diagnose GitHub ruleset refusals (GH013) in git push output, explaining the Write role bypass requirement on ruleset 23059172.

Configure release Typer application with exit_on=DevOpsCLIError for safe CLI error presentation without unhandled tracebacks.

Update HELP.roadmap.close, RELEASE_CYCLE.md, k8s/README.md, and changelog.d/1124.md to document the ruleset bypass architecture.

Add offline tests covering all typed failure modes and ruleset refusal diagnostics.

* fix(roadmap): job clone tracks the default branch while the release has none (#1366) (#1412)

The roadmap job clone fetches with --prune and tracks release/<v> only while origin has it, and origin's default branch otherwise, so close and refine run between a ship and the next release's start. Every other git failure still raises GitOperationError.

* fix(github): a gh call at a quota window's reset waits out the reset second (#1364) (#1413)

* fix(roadmap): send refine's schema to the model, cache only valid replies and skip only a failed item (#1363) (#1424)

* test(security): the Vault read test answers at the HTTP edge instead of patching the broker (#1423)

test_vault_broker_get_secret_api_success patched HttpClientBroker.request, a devops-cli internal, so the read skipped vault_request, the egress-vetted factory client and the URL Vault is asked for. It now serves the KV-v2 reply through the stub_web fixture (httpx2 MockTransport) and asserts the method, URL and X-Vault-Token of each request Vault received. With vault_url dropping the /v1 prefix the old test still passed; this one fails.

Applies finding 17 of the v0.2.29 devsecops review (session 20261008-143745). The file's other patched-broker tests move with #1332.

* fix(roadmap): closure closes the items delivered into a release whose milestone has closed (#1362) (#1422)

* fix(roadmap): the metrics job walks its own clone's release tags, and intake stops on an unusable labels.yml before any model call (#1358) (#1426)

* fix(roadmap): a critical fix joins a cut release while its release pull request is open (#1294) (#1442)

A cut release now admits a critical fix, so its pull request merges into the release branch before the release pull request does. A release whose pull request merged and is not yet published gets its own state, merged, which sends a critical fix on to the next release.

* fix(roadmap): intake restores an issue's archived board card instead of failing every round (#1403) (#1444)

* fix(security): upgrade pydantic-ai to 2.54.0, past three advisories that fail the devops ci audit (#1446) (#1447)

pydantic-ai 2.35.0 carried GHSA-4x9p-g9wm-8q7f, GHSA-fpf4-vwcp-v4hp and GHSA-vmxc-h2x2-jmf3, so uv audit failed devops ci and the pre-push gate on every branch. The pin moves to 2.54.0, and the resolver moves anthropic, openai and google-genai with it. The private pydantic-ai imports that 2.54.0 broke now use public APIs: genai-prices for pricing, pydantic_ai.durable_exec's engine builder for LocalDurabilityCapability, pydantic_ai.run for the enqueue types and OpenTelemetry's propagator for the traceparent. Unused re-exports of pydantic-ai internals and the _is_call_ctx monkey-patch are removed. pydantic_ai._ssrf stays, because pydantic-ai has no public SSRF classifier; the task file lists it for #1001.

* fix(roadmap): hold every Service round until a GraphQL refusal's reset, and end each round with its spend line (#1400) (#1445)

* fix(roadmap): a shipped release starts the next one without a person (#1360) (#1448)

* fix(roadmap): an item a person places in a release stays there (#1349) (#1449)

* fix(release): publish the Service image from its release branch, so main never pins a missing image (#1451) (#1452)

Each push to release/vX.Y.Z that holds X.Y.Z and changes the image's inputs
builds, smoke-tests and scans service:vX.Y.Z, pushes it by digest, attests
it and then tags it. Right before it tags, the run checks again that its
commit is the branch tip and that main doesn't hold the version, so a release
merged during the build keeps the image main pins. The branch run fails when
main has image changes the branch lacks (git merge-tree), and when the branch
tip can't be read.

On main, release.yml points latest at that image once its release.yml
provenance verifies (gh attestation verify, signed on main or the release
branch), warns when main's tree has other image inputs, never replaces a tag
main pins, and builds only when no image has the tag. ci.yml's Service Image
job skips this repository's release pull request, whose tree release.yml
already builds.

* chore(release): collect the v0.2.29 changelog fragments (#1453)

* chore(release): bump to v0.2.29 (#1454)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ci GitHub Actions workflows, pre-commit hooks, CI gates, and runners scope/k8s Kubernetes commands, Helm charts, pods, services, and policies scope/release The release-please workflow, the changelog and the published artifacts type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant