ci(docker): add workflow_dispatch to build a SHA-tagged preview image - #11110
Open
tonio-alucema wants to merge 2 commits into
Open
ci(docker): add workflow_dispatch to build a SHA-tagged preview image#11110tonio-alucema wants to merge 2 commits into
tonio-alucema wants to merge 2 commits into
Conversation
`docker.yml` only triggered on `push` to `master` and on `v*` tags, so
there was no way to build an image from an unmerged branch. Previewing a
change end to end before merging therefore had no image to deploy, and
because the concurrency group is `docker-${github.ref}` a *pending*
master run can still be superseded by the next push — so an arbitrary
master SHA is not guaranteed to have an image either.
Add a `workflow_dispatch` trigger with an optional `ref` input:
- The manual run checks out `inputs.ref` (falling back to `github.sha`),
resolves the exact commit, and publishes a `sha-<short>` image tag for
that commit. The `latest` and `v*`/semver tags stay gated to the push
and tag events, so a dispatch never publishes a release tag.
- `type=sha` is kept exactly as-is for push/tag events; the dispatch tag
is emitted as a raw `sha-<short>` of the resolved commit so it is
correct even when the built ref differs from `github.sha`.
- The commit stamped into the image (`PAPERCLIP_BUILD_COMMIT`) is taken
from the same resolved commit; on push/tag it equals `github.sha`, so
those builds are unchanged.
This is intentionally not the release workflow, which publishes a stable
`v*` tag — a much bigger act than building a review image. The resulting
`sha-<short>` tag is consumed as an ordinary app ref by the fleet deploy
tooling, so nothing downstream changes.
Tested: `actionlint` clean on the workflow; YAML parses; verified the
diff leaves the push/tag paths byte-for-byte behaviourally identical
(`ref` and `PAPERCLIP_BUILD_COMMIT` both resolve to `github.sha`, and
`type=sha` is unchanged when `github.event_name != 'workflow_dispatch'`).
Co-Authored-By: Paperclip <noreply@paperclip.ing>
tonio-alucema
requested review from
cryppadotta,
devinfoley and
nickyleach
as code owners
August 9, 2026 00:30
Contributor
Author
|
@greptile-apps review |
The workflow_dispatch `ref` input is meant to preview an unmerged branch,
and the only ref guaranteed to carry this workflow after merge is master —
so the expected way to run it is dispatch-from-master with `ref` set to the
branch. But on a workflow_dispatch dispatched from master, `github.ref` is
the default branch, so `type=raw,value=latest,enable={{is_default_branch}}`
still fired: a preview image would move `latest` and poison every host that
pulls it. `type=semver` was likewise ungated (a dispatch from a v* tag would
have minted a release tag pointing at the previewed ref).
Gate both off for workflow_dispatch so a manual run can only ever produce
the `sha-<short>` tag. The `latest` gate now checks the default branch
explicitly instead of `{{is_default_branch}}` so it can also exclude the
dispatch case; on push:master and tag:v* the emitted tags are unchanged.
Tested: js-yaml and ruby YAML both parse the file; grep confirms both the
self-hosted and cloud meta blocks are gated symmetrically.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Contributor
Author
|
Pushed @greptile-apps review |
Contributor
Author
|
@greptile-apps review |
1 similar comment
Contributor
Author
|
@greptile-apps review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thinking Path
Linked Issues or Issue Description
No public GitHub issue exists. The problem is described below.
Current behavior
docker.ymltriggers only onpushtomasterand onv*tags. There is no way to build an image from an unmerged branch. A preview of a change before merge has no image to deploy. In addition, the per-ref concurrency group supersedes a pendingmasterrun when the next push arrives, so an arbitrarymastercommit can have no image.Proposed behavior
Add a
workflow_dispatchtrigger with an optionalrefinput. The manual run checks out that ref, builds it, and pushes an image taggedsha-<short>for the built commit. The manual run does not publishlatestor av*/semver release tag. The push and tag paths do not change.Reason and benefit
An operator can build a preview image for any unmerged branch, tag, or commit. This is the reliable way to be sure a ref has an image before you pin it as an app ref. This uses a dedicated preview build. It does not use the release workflow, because the release workflow publishes a stable
v*tag, which is a much bigger action than a review image.What Changed
workflow_dispatchtrigger todocker.ymlwith an optionalrefinput (default: the dispatched ref).${{ inputs.ref || github.sha }}. On push and tag events this resolves togithub.sha, the checkout default.Resolve build refstep that reads the exact checked-out commit (git rev-parse HEAD) and its short SHA.type=shaunchanged for push and tag events. For a manual run it is disabled, and a rawsha-<short>tag of the resolved commit is used instead. This keeps the SHA tag correct even when the built ref differs fromgithub.sha.PAPERCLIP_BUILD_COMMITfrom the resolved commit. On push and tag events this value equalsgithub.sha, so those images do not change.Verification
actionlintreports no issues on.github/workflows/docker.yml.inputs.refis empty on those events, so the checkout ref andPAPERCLIP_BUILD_COMMITboth resolve togithub.sha.type=shais enabled only whengithub.event_name != 'workflow_dispatch', so it is unchanged on push and tag events.sha-<short>tag and nov*tag.Risks
Low risk. The change adds a new trigger and does not alter the push or tag build behavior. A
workflow_dispatchrun never publishes a release pointer:latest,type=semver, and the stocktype=shatag are all gatedenable=${{ github.event_name != 'workflow_dispatch' }}, andlatestadditionally replaces{{is_default_branch}}with an explicitgithub.ref_name == default_branch && github.event_name != 'workflow_dispatch'check. So even a manual run dispatched frommasterleaveslatestand everyv*/semver tag untouched and publishes onlysha-<short>. Push and tag builds are byte-for-byte unchanged becauseinputs.refis empty andgithub.event_nameispush/tagon those events.Model Used
claude-opus-4-8.actionlint, git).Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template#NNN/github.com/paperclipai/paperclipURLs)docs/...,fix/...) and contains no internal Paperclip ticket id or instance-derived details