Skip to content

containers: no validation runs before the tag every consumer pins moves #142

Closed

Description

@mmcky

Container changes get no automated signal until after they are merged and published. The merge that first builds an image is the same event that pushes :latest, which every consumer pins — so the window between "broken image built" and "broken image live in seven lecture repos" is zero.

Today

build-containers.yml:3-17 triggers on push to main (paths containers/**), the weekly cron, and dispatch. There is no pull_request trigger anywhere for container builds. Both build steps are push: true to a latest tag (:62/:70 and :104/:110).

test-container.yml:6-11 fires only on workflow_dispatch or a completed build run, and :33 hardcodes ghcr.io/quantecon/${{ matrix.image }}:latest — the smoke suite is structurally incapable of testing anything but an already-published image.

The action harness does not cover this and currently disguises it: test-actions.yml triggers on pull_request but never builds or pulls an image, and the gate's IGNORED regex (:112) does not list containers/. A containers-only PR therefore runs the full harness and reports the required check Action harness: all checks green, having asserted nothing whatsoever about the image. That is the "green that reads as coverage" defect #108 was filed about, relocated.

The exposure is not hypothetical: #28 (stack drift breaking lecture execution), #85 (kaleido/Chrome), #103 (publish pipeline) were all image defects, and Dependabot proposes conda and docker bumps against both container directories weekly with nothing validating them.

Phase 1 — validate on the PR

  • On pull_request touching containers/**, detect which image directories changed and build only those, with cache-from the published :latest to keep it minutes rather than a cold hour
  • Push to a PR-scoped tag (pr-<N>), never :latest, and run the existing containers/quantecon/tests/smoke-test.sh against it in a needs: job with container: ghcr.io/quantecon/<image>:pr-<N>
  • Delete the PR tag when the PR closes
  • Add containers/ to the harness relevance gate, or make the container job part of the required check, so a containers-only PR can no longer report green from jobs that never touched an image
  • Skip on forks (github.event.pull_request.head.repo.fork == false) — do not reach for pull_request_target, see fix(preview): surface deploy errors, pin CLIs, remove unsafe fork guidance #105

Do not copy the shape the audit that prompted this suggested (push: false + load: true + docker run). A locally-loaded image cannot back a container: block, and docker run is the HOME=/root execution mode that #125 deliberately replaced — it is the reason #85 escaped the smoke tests in the first place. Pushing a PR-scoped tag keeps the real container: job semantics.

Phase 2 — gate the tag itself

Even with phase 1, the weekly cron and any direct push still move :latest before a test meets it. lecture-dp's weekly cache build crons at 0 2 * * 1, the same minute build-containers.yml does, against quantecon-build:latest.

  • Publish only the main-<sha> tag from build-containers.yml, run the smoke suite against that tag, and retag :latest on green

This is the same structural flaw that made action release-gating P0 (#135, #136, #138) — an artifact reaching consumers before anything verified it — applied to the container tag instead of the action ref. Worth sequencing after #136 so it reuses whatever that lands, and cheap now that smoke-test.sh exists and runs in minutes.

Related

#108 — this makes its fixture changes (theme, fontpkg) validatable on the PR instead of by manual dispatch. #100's coverage table should record that containers are covered post-merge only. #141 — the matrix that is currently the only post-publish safety net has been silently red for three weeks.

Activity

  1. added
    high-priority
    infrastructure
    on Aug 11, 2026
  2. mmcky commented on Nov 4, 2026

    @mmcky
    ContributorAuthor

    From the 2026-10-06 codebase review (finding H1; record: .qe/dev/log/2026-10-06-codebase-review.md, #220).

    The review reached this issue's diagnosis independently, and its validation confirmed it against build-containers.yml at 4550f69. These additions for phase 2 are not here yet:

    • An immutable candidate tag. type=sha,prefix={{branch}}- gives main-<sha>. A scheduled or dispatched rebuild of an unchanged main overwrites that tag, and its contents can differ between builds because apt, conda and pip packages are unpinned. Gate on a tag that cannot be reused, such as a dated tag plus the SHA.
    • A rollback handle. Write the pushed digest to the step summary. Old digests stay pullable, so docker buildx imagetools create -t …:latest …@sha256:<old> is a rollback, but nothing records which digest was last good. CONTRIBUTING's Rollback section covers only v0.
    • The mechanism.
      • Call test-container.yml through workflow_call with an image input, and remove its workflow_run trigger, or it re-tests :latest.
      • Add a promote job in the same run, needs: the smoke test, that uses imagetools create, so the promoted digest is the tested digest.
      • Keeping the promote job in the same run means a cancelled newer run cannot leave an older candidate to be promoted.
      • Promote each image on its own, unless the two should move together.
    • What gates. test-containers-lectures.yml takes two hours or more per lecture-python.myst leg, it was red from mid-September until 🔴 CI failure: Test Container Builds #159 closed on 2026-10-05, and it has been red again since 2026-10-12 (🔴 CI failure: Test Container Builds #222). It fits better as a check after promotion than as the gate.
    • Clean-up. Remove old candidate tags. Once this lands, replace CONTRIBUTING's "Container images do not stage" limit with the rollback procedure.

    #150's dispatch tag input for test-container.yml overlaps the mechanism.

  3. 7 remaining items

  4. added a commit that references this issue on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    high-priorityinfrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions