Skip to content

accept JSON arrays for bake vars to preserve multiline values - #530

Merged
crazy-max merged 2 commits into
docker:masterfrom
crazy-max:vars-json-support
Oct 14, 2026
Merged

crazy-max merged 2 commits into
docker:masterfrom
crazy-max:vars-json-support

Conversation

@crazy-max

Copy link
Copy Markdown
Member

Allow the vars input to accept a JSON array of KEY=value strings so multiline values, whitespace, and literal quotes reach Buildx unchanged. Fall back to the existing list parser when JSON parsing fails, preserving the current newline-delimited input format.

I found this while working on docker/actions-toolkit#1373 to forward DOCKER_METADATA_OUTPUT_* variables. Metadata outputs such as tags, labels, and annotations contain newlines, which become separate variable entries when serialized into the line-based input. JSON arrays preserve each value as a single --var argument.

Parse the vars input as a JSON array of strings, falling back to the
existing list parser when JSON parsing fails. Preserve multiline values,
whitespace, and literal quotes in each Buildx --var argument.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max merged commit dae0adf into docker:master Oct 14, 2026
54 checks passed
@crazy-max
crazy-max deleted the vars-json-support branch October 14, 2026 10:12
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.

2 participants