Skip to content

bake: pass variables explicitly to buildx - #277

Open
crazy-max wants to merge 1 commit into
docker:mainfrom
crazy-max:bake-vars
Open

crazy-max wants to merge 1 commit into
docker:mainfrom
crazy-max:bake-vars

Conversation

@crazy-max

@crazy-max crazy-max commented Aug 13, 2026 •

Copy link
Copy Markdown
Member

needs

Disable ambient Bake variable lookup so workflow and runner environment values cannot implicitly override the Bake definition. Pass caller-provided variables explicitly to both definition validation and docker/bake-action.

Use the BakeVars helper to forward CI and variables with GITHUB_, RUNNER_ or DOCKER_METADATA_OUTPUT_ prefixes, with caller-provided values taking precedence. Serialize the action input as JSON to preserve multiline metadata values. The workflow fixture verifies allowed variable forwarding, multiline tags and labels, caller overrides, and exclusion of unrelated environment values.

@sysia48

This comment was marked as spam.

@crazy-max
crazy-max force-pushed the bake-vars branch 2 times, most recently from 390133a to 24c9901 Compare October 5, 2026 13:18
@crazy-max
crazy-max marked this pull request as ready for review October 5, 2026 13:20
@crazy-max
crazy-max requested a review from a team as a code owner October 5, 2026 13:20
@crazy-max
crazy-max force-pushed the bake-vars branch 2 times, most recently from cfe01fc to 1bbde63 Compare October 5, 2026 14:16

@tonistiigi tonistiigi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will the DOCKER_METADATA_OUTPUT_ be handled after this change? Don't we need some special case for it as well?

@crazy-max

crazy-max commented Oct 13, 2026 •

Copy link
Copy Markdown
Member Author

How will the DOCKER_METADATA_OUTPUT_ be handled after this change? Don't we need some special case for it as well?

Good catch, opened docker/actions-toolkit#1373

Edit: Also needs docker/bake-action#530

Disable ambient Bake variable lookup so runner environment values cannot
implicitly override the definition. Use BakeVars to forward CI, GITHUB_,
RUNNER_ and DOCKER_METADATA_OUTPUT_ values, preserving caller precedence.

Pass variables explicitly to definition validation and bake-action. Serialize
the action input as JSON to preserve multiline metadata values.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

3 participants