bake: Resource interpolation doesn't get attributes merged
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 682
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 29
Description
Contributing guidelines
- I've read the contributing guidelines and wholeheartedly agree
I've found a bug and checked that ...
- ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
HCL resource interpolation gets attributes overridden by the last configuration, instead of the merged actual value.
Expected behaviour
Resource interpolation get all labels of target "test".
{
"group": {
"default": {
"targets": [
"test"
]
}
},
"target": {
"default": {
"context": ".",
"dockerfile": "Dockerfile",
"labels": {
"bar": "baz",
"foo": "bar"
}
},
"test": {
"context": ".",
"dockerfile": "Dockerfile",
"labels": {
"bar": "baz",
"foo": "bar"
}
}
}
}
Actual behaviour
Resource interpolation only get labels in docker-bake.override.hcl.
{
"group": {
"default": {
"targets": [
"test"
]
}
},
"target": {
"default": {
"context": ".",
"dockerfile": "Dockerfile",
"labels": {
"bar": "baz"
}
},
"test": {
"context": ".",
"dockerfile": "Dockerfile",
"labels": {
"bar": "baz",
"foo": "bar"
}
}
}
}
Buildx version
github.com/docker/buildx v0.12.0-desktop.2 c5a13b51c1ae9358eb691e9a21c955590e26d0a0
Docker info
No response
Builders list
NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS
default * docker
default default running v0.11.7+d3e6c1360f6e linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
desktop-linux error
Cannot load builder desktop-linux: protocol not available
Configuration
docker buildx bake --print default test
# docker-bake.hcl
target "default" {
labels = target.test.labels
}
target "test" {
labels = {
"foo": "bar"
}
}
# docker-bake.override.hcl
target "test" {
labels = {
"bar": "baz"
}
}
Build logs
No response
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the docker-bake.hcl and docker-bake.override.hcl examples, starting with docker buildx bake --print default test. Trace the bake resource interpolation and attribute merge path; done means the printed default and test targets retain both bar and foo labels from the merged configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100