Skip to content

feat: add bake/specs.hcl with the shared tag, label and annotation rules - #82

Draft
Ilyes512 wants to merge 4 commits into
mainfrom
4.0/specs-hcl
Draft

Ilyes512 wants to merge 4 commits into
mainfrom
4.0/specs-hcl

Conversation

@Ilyes512

@Ilyes512 Ilyes512 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Adds bake/specs.hcl, the file consumers will vendor next to their docker-bake.hcl, with specs_tags, specs_labels and specs_annotations (handoff Part 1, step 3, option C).

  • Tag push: semver set (1.2.3, 1.2 unless 0.0.x, 1 unless 0.x), plus latest (or the bare variant) only when IS_STABLE. A prerelease publishes only itself.
  • PR pr-N, branch name (sanitized), schedule nightly, dispatch tag, and :local for a local build.
  • Labels/annotations: version, revision, source, url, created, licenses, title, description, the same keys metadata-action gave 3.x images. An empty title or description falls back to the repository's (REPOSITORY_NAME / REPOSITORY_DESCRIPTION), as in 3.x. Empty values are left out.

bake/test/run.sh (task test) runs docker buildx bake --print for 12 cases (tag v1.2.3, -rc.1, v0.1.0, v0.0.5, non-semver, PR, branch, schedule, dispatch, local, unknown event) and diffs the result against the expected JSON. lint.yml runs it.

Part of the 4.0.0 stack (bake variant of the plan in #80). Merge bottom to top: #82 → #83 → #84 → #85 → #86.

The functions specs_tags, specs_labels and specs_annotations work out an
image's metadata from the variables bake.yml's plan job will set, so a
consumer's docker-bake.hcl describes what to build and this file decides
how it is tagged. Local builds get the defaults: a :local tag and
version dev.

bake/test/run.sh runs docker buildx bake --print on an example HCL file
for a set of events and compares the result with the expected JSON;
lint.yml runs it on every push.
@Ilyes512
Ilyes512 added this pull request to stack #87 November 9, 2026 12:06
@Ilyes512 Ilyes512 changed the title Add bake/specs.hcl with the shared tag, label and annotation rules feat: add bake/specs.hcl with the shared tag, label and annotation rules Nov 9, 2026
…labels

Images published with the 3.x workflows carry title, description and
licenses labels that metadata-action took from the repository. To keep
that key set, specs_labels now falls back to REPOSITORY_NAME and
REPOSITORY_DESCRIPTION when the title or description passed in is
empty, and always adds LICENSES. All three are empty locally, so a
local build is unchanged.

The utils test target passes an empty title and description, so the
fixtures cover the fallback as well as an explicit value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant