Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bake: fix using push override with output definition#773

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

tonistiigi
Copy link
Member

Currently, using bake --push will replace the target definition with type=registry. This means that if the definition defined an output then it gets cleared and completely overwritten.

I think the basis of this refactor can also be used to implement additional operators like --set key+=value in the future.

Signed-off-by: Tonis Tiigi tonistiigi@gmail.com

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I think the basis of this refactor can also be used to implement additional operators like --set key+=value in the future.

Wonder if we could also add this kind of logic in the HCL def like:

# docker-bake.hcl
target "webapp" {
    dockerfile = "Dockerfile.webapp"
    tags = ["username/webapp:latest"]
}
# docker-bake2.hcl
target "webapp" {
    extends {
        tags = ["ghcr.io/username/webapp:latest"]
    }
}

@tonistiigi
Copy link
Member Author

@crazy-max With referencing targets you could do

target "webapp" {
    tags = concat(target.webapp.tags, ["ghcr.io/username/webapp:latest"])
}

@tonistiigi tonistiigi merged commit 0cea838 into docker:master Sep 22, 2021
@kevbook
Copy link

kevbook commented Oct 5, 2022

I am also trying to merge tags, but I am getting the following error with this syntax. Any help would be appreciated (no rush though).

target "webapp" {
    tags = concat(target.baseimg.tags, ["ghcr.io/username/webapp:latest"])
}

ERROR: build-pipeline.hcl: Unknown variable; There is no variable named "target"., and 1 other diagnostic(s)

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.

3 participants