Skip to content

Commit fa80f20

Browse files
authored
Merge pull request #66 from slimreaper35/build-args
build: Use normalized platform spec for ARG expansion
2 parents b65ffa9 + cd9b1de commit fa80f20

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

integration_tests/build_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -713,13 +713,6 @@ LABEL test.label="platform-build-args-test"
713713
imageLabel := imageLabels[label]
714714
containerfileLabel := containerfileLabels[label]
715715

716-
// the *VARIANT values will be empty on platforms other than ARM
717-
expectEmpty := strings.HasSuffix(label, "VARIANT") && runtime.GOARCH != "arm"
718-
if !expectEmpty {
719-
Expect(imageLabel).ToNot(BeEmpty(), fmt.Sprintf("label %s is empty on the built image", label))
720-
Expect(containerfileLabel).ToNot(BeEmpty(), fmt.Sprintf("label %s is empty in the containerfile JSON", label))
721-
}
722-
723716
Expect(imageLabel).To(Equal(containerfileLabel),
724717
fmt.Sprintf("image label: %s=%s; containerfile label: %s=%s", label, imageLabel, label, containerfileLabel),
725718
)

pkg/commands/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ func (c *Build) parseContainerfile() (*dockerfile.Dockerfile, error) {
556556
func (c *Build) createBuildArgExpander() (dockerfile.SingleWordExpander, error) {
557557
// Define built-in ARG variables
558558
// See https://docs.docker.com/build/building/variables/#multi-platform-build-arguments
559-
platform := platforms.DefaultSpec()
559+
platform := platforms.Normalize(platforms.DefaultSpec())
560560
args := map[string]string{
561561
// We current don't explicitly expose the --platform flag, so the TARGET* values always
562562
// match the BUILD* values. If we add --platform handling, we would want to respect it here.

0 commit comments

Comments
 (0)