Repository navigation
Conversation
This was referenced Nov 9, 2026
Ilyes512
force-pushed
the
4.0/bake-workflow
branch
from
November 9, 2026 12:31
484dee1 to
62b2ff1
Compare
Ilyes512
force-pushed
the
4.0/bake-workflow
branch
2 times, most recently
from
November 10, 2026 16:31
2177885 to
0e3b034
Compare
Ilyes512
force-pushed
the
4.0/bake-workflow
branch
from
November 21, 2026 16:48
7b95451 to
25c57de
Compare
One call builds and publishes everything a consumer's docker-bake.hcl defines: - plan works out the version, the push decision and the other bake variables once, runs docker buildx bake --print and freezes the result, so every later job sees identical tags and labels (created included). - build runs once per platform, building every target for that platform in one bake invocation, and pushes by digest. - publish merges the digests per target with imagetools create and copies the labels onto the index and its descriptors. - status reports the result as a single "Image" check. push now follows the event instead of github.actor: no push for dependabot pull requests (also when a person re-runs them), pull requests from forks, dependabot branches, or events the tag rules don't cover. Build secrets come in through one build-secrets secret. Every input reaches the scripts through env, and every action is pinned by commit SHA. The plan job warns when the consumer's vendored specs.hcl differs from bake/specs.hcl at this version, by comparing it with SPECS_HCL_SHA256; lint.yml checks that hash, and tests the plan job's version and push rules. test-bake.yml runs the workflow on a test image (pushing only on a manual run), and builds, loads and runs one target the way a consumer's pull request test would.
They reach bake as REPOSITORY_NAME, REPOSITORY_DESCRIPTION and LICENSES, the fallbacks specs_labels uses for the title, description and licenses labels, so a migrated image keeps the labels metadata-action gave it. The repository is read once from the GitHub API with the token's contents: read; an unrecognised license (NOASSERTION) is left out. SPECS_HCL_SHA256 follows the specs.hcl change.
Every scripted step of bake.yml is now a script in a small composite action under bake/ (plan, narrow, secrets, digests, publish), called with the $/ self-repository syntax so it runs at the same commit as bake.yml. The larger jq programs live in .jq files next to the scripts, and the scripts share their output helpers in bake/lib.sh. The plan action reads bake/specs.hcl from its own checkout before the caller's bake files, so consumers no longer keep a copy of it. The specs-file input, SPECS_HCL_SHA256 and its check are gone; a local build fetches specs.hcl at the commit the caller pins bake.yml to. The tests now run the scripts directly: vars.sh for the plan variables, secrets.sh for the build secrets parsing, and pipeline.sh for freeze, narrow, digests and publish end to end, against golden files and with a docker that only records the imagetools calls. Shellcheck lints the scripts, locally and in CI.
…en files test-bake.yml now pushes on pull requests from this repository and checks the published indexes, which replaces bake/test/pipeline.sh and its 1,080 lines of expected output.
The plan job writes bake --print as bake.json and a definition per platform next to it, so the narrow and digests actions go. The build jobs upload bake's metadata as is, and publish reads the tags, labels and digests from bake.json and that metadata.
A repository calls bake.yml once per run, so the per-call artifact prefix and the output that carried it go.
The caller already controls its own workflow, so refusing names like PATH protects nothing. The step keeps the NAME=value check and the masking, and lib.sh moves next to the plan scripts, its only users.
… labels The plan job no longer reads the repository from the GitHub API. Targets pass their title and description to specs_labels, and an empty one is left out like any other empty value.
specs.hcl derives it from EVENT, REF_TYPE and VERSION, so the tag rules live in one place and a local build no longer needs IS_STABLE set to preview a release.
cleanup-e2e.yml removes the pr-<N> images test-bake.yml published once the pull request is closed, and the untagged platform images nothing refers to any more.
imagetools inspect right after imagetools create can get a 404 from GHCR, which failed a publish that had succeeded.
Ilyes512
force-pushed
the
4.0/bake-workflow
branch
from
November 21, 2026 16:53
25c57de to
db34a0a
Compare
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.
One call builds and publishes every target in a consumer's bake files:
plan→build(one job per platform) →publish→status(Image).bake --printand freezes the result as an artifact: the printed JSON as it is, and one definition per platform with only the targets that list it, pushed by digest and without tags. Every platform and the publish job therefore see identical tags and labels. It readsbake/specs.hclfrom this repository, at the version of the workflow, before the consumer's bake files, so consumers don't keep a copy. It fails early when a target has no platforms, has no tags for an event it would push, or needs a runner that isn't mapped.docker/bake-actionrun, pushes by digest and uploads bake's metadata. Cache scope is per image, target and platform. Default attestations are off, andattestin HCL opts in.imagetools createper target, with the labels asindex:andmanifest-descriptor:annotations. It does no checkout.dependabot/*branches, or events the tag rules don't cover.build-secretsis a secret, not an input; each line must beNAME=valueand its value is masked. All inputs go throughenv:.permissionsare set per job, all actions are pinned by SHA, and checkout usespersist-credentials: false.ubuntu-26.04/ubuntu-26.04-armby default; therunnersinput overrides them.Scripts. The plan and publish logic lives in two composite actions under
bake/(plan,publish), called with GitHub's$/self-repository syntax, so it always runs at the same commit asbake.yml. The build job's two small steps, exporting the build secrets and saving bake's metadata, are inline. The artifacts have fixed names (bake-definition,bake-metadata-<platform>): a repository callsbake.ymlonce per run.specs.hclchanges on top of #82. TheREPOSITORY_NAME,REPOSITORY_DESCRIPTIONandLICENSESvariables are gone: there is no GitHub API lookup, a target passes its own title and description, and an empty one is left out.IS_STABLEis no longer a variable either:specs.hclworks it out fromEVENT,REF_TYPEandVERSION, with the fixtures unchanged apart from the removed labels.$/across repositories. GitHub's docs don't say what$/resolves to inside a reusable workflow called from another repository. A test from a scratch branch inspecsnl/utils, pinned to this branch's commit, settled it: every job,Publishincluded, downloadedspecsnl/github-actions@<that commit>. utils has nospecs.hcl, and the build published both platforms with the expected labels. The branch and its run were only for the test, and the branch has been removed.actionlint 1.7.12 knows neither the
$/syntax nor the 26.04 labels yet (rhysd/actionlint#711), so.github/actionlint.yamldeclares the labels (added in #82) and ignores only the two$/format errors.Tests (
task test, andlint.yml):bake/test/vars.shrunsbake/plan/vars.shfor 18 GitHub contexts.test-bake.ymlruns the workflow on a test image. On a pull request from this repository and on a push tomainit pushes, and itsVerifyjob checks the platforms and annotations of the published indexes; a manual run pushes only withpushon. Aload: truejob covers the PR-style test.cleanup-e2e.ymlruns every night and deletes thepr-<N>test images of closed pull requests, and the untagged platform images no tag refers to any more (only those older than a day, so a run that is still publishing keeps them). A manual run can be a dry run.task lint).Part of the 4.0.0 stack (bake variant of the plan in #80). Merge bottom to top: #82 → #83 → #84 → #85 → #86 → #88.