Skip to content

inconsistent bake files merge order #2236

@crazy-max

Description

@crazy-max

follow-up:

When using cwd:// prefix to load local files, the order when merging definitions is inconsistent.

Repro:

# docker-bake.hcl
target "default" {
	dockerfile-inline = <<EOT
FROM scratch
COPY foo /foo
EOT
}
# docker-bake-cwd.hcl
target "default" {
	dockerfile-inline = <<EOT
FROM scratch
COPY bar /bar
EOT
}
$ touch bar
$ docker buildx bake -f docker-bake.hcl -f cwd://docker-bake-cwd.hcl
#0 building with "integration-remote-50k0za15d0dzwgux4ky9yhd1e" instance using remote driver
        	            	
#1 [internal] load local bake definitions
#1 reading docker-bake-cwd.hcl 80B / 80B done
#1 reading docker-bake.hcl 80B / 80B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 64B done
#2 DONE 0.0s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [internal] load build context
#4 transferring context: 2B done
#4 DONE 0.0s

#5 [1/1] COPY foo /foo
#5 ERROR: failed to calculate checksum of ref yckkdgn9arucath7i0lceuonf::4f9gaja38fx3nykbaexosznxj: "/foo": not found
------
 > [1/1] COPY foo /foo:
------
Dockerfile:2
--------------------
   1 |     FROM scratch
   2 | >>> COPY foo /foo
   3 |     
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref yckkdgn9arucath7i0lceuonf::4f9gaja38fx3nykbaexosznxj: "/foo": not found

In the logs we can see it loads first docker-bake-cwd.hcl but should be docker-bake.hcl.

Seems related to #1838

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions