Skip to content

build: validate build args and labels - #2040

Merged
jedevc merged 1 commit into
docker:masterfrom
crazy-max:validate-build-args
Sep 11, 2023
Merged

jedevc merged 1 commit into
docker:masterfrom
crazy-max:validate-build-args

Conversation

@crazy-max

@crazy-max crazy-max commented Sep 11, 2023 •

Copy link
Copy Markdown
Member

fixes #2022

Adds validation for build arguments and labels that must have a key to be consistent with previous implementation of the build command in docker/cli.

We already have this validation for bake when we set new overrides:

buildx/bake/bake.go

Lines 430 to 432 in f6b7a3c

if len(parts) != 2 && keys[1] != "args" {
return nil, errors.Errorf("invalid override %s, expected target.name=value", v)
}

buildx/bake/bake.go

Lines 456 to 458 in f6b7a3c

if len(keys) != 3 {
return nil, errors.Errorf("invalid key %s, args requires name", parts[0])
}
but missing for labels.

@crazy-max crazy-max changed the title build: validate build args build: validate build args and labels Sep 11, 2023
@crazy-max crazy-max added this to the v0.12.0 milestone Sep 11, 2023
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max
crazy-max marked this pull request as ready for review September 11, 2023 15:04
@jedevc
jedevc merged commit 8d001e3 into docker:master Sep 11, 2023
@crazy-max
crazy-max deleted the validate-build-args branch September 11, 2023 17:04
@crazy-max crazy-max mentioned this pull request Apr 5, 2024
19 of 35 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v23 regression] docker build --build-arg =TEST_STRING no longer fails

2 participants