Skip to content

Release Docker images can mismatch the version tag (build-main uses a moving ref) #414

Closed

Description

@ptr727

Problem

In publish-release.yml, the versioned release is built from a moving branch ref:

  • get-version resolves the release version/GitCommitId from ref: main.
  • build-main builds and pushes the product images from ref: main as well, and build-docker-task.yml re-resolves its own version internally from that ref.
  • github-release then tags the release with get-version's SemVer2 and checks out its GitCommitId.

If a commit lands on main between get-version and build-main (e.g. during the weekly scheduled publish), the pushed image's embedded version and the release tag can come from different commits — the SemVer2 Docker tag would point at image contents built from a newer commit than the GitHub release of the same tag.

This is the same race fixed in the sibling repos (ptr727/PlexCleaner#723, ptr727/ProjectTemplate#107) by pinning the leaf builds to needs.get-version.outputs.GitCommitId instead of the branch name.

Why it isn't a one-line fix here

The PlexCleaner/ProjectTemplate fix (ref: ${{ needs.get-version.outputs.GitCommitId }}) cannot be applied directly to NxWitness, because build-docker-task.yml overloads inputs.ref for two purposes:

  1. the git ref to check out / version, and
  2. the image-matrix branch selector — Make/Matrix.json rows are filtered with select(.Branch == $ref) (see the get-matrix job).

Passing a commit SHA would match no .Branch rows and build nothing.

Proposed fix

Decouple the two concerns in build-docker-task.yml:

  • Add a distinct branch input used only for the matrix row filter (.Branch == $branch) and for tag derivation.
  • Keep ref for checkout/version, and let callers pin it to an immutable commit.
  • In publish-release.yml, call build-main with branch: main + ref: ${{ needs.get-version.outputs.GitCommitId }} and needs: [get-version, build-base]. build-develop keeps branch: develop (its output is the mutable develop tag, which doesn't need release-commit pinning; pin it too if a develop get-version is added).
  • Update the test-pull-request.yml smoke caller (which passes smoke_branch) accordingly.

Context

Surfaced while back-porting the two-phase CI/CD fixes from PlexCleaner; see PR #413 (which applies the safe smoke-gate change and references this issue). Low practical risk (requires a commit landing on main mid-publish), but worth fixing for release reproducibility.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions