buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Bake fails to push if any targets don't have tags

Open ciaranmcnulty opened this issue 3 years ago • 4 comments

Currently we have some complex-ish logic about which tags apply to each target. In some cases a target may not need to be tagged at all.

When I bake --push, the whole thing fails immediately with error: tag is needed when pushing to registry

I think a better rule would be to show that error when no targets have tags? Or provide some way to do this kind of partial push

ciaranmcnulty avatar Jun 10 '22 09:06 ciaranmcnulty

Reproducer:

group "default" {
  targets = ["foo", "bar"]
}
target "foo" {
  dockerfile-inline = "FROM php:5.6"
  tags = []
}
target "bar" {
  dockerfile-inline = "FROM php:5.6"
  tags = ["myrepo/bar"]
}

I'd like that to complain that I don't own myrepo :)

ciaranmcnulty avatar Jun 10 '22 09:06 ciaranmcnulty

I appreciate I could provide the target names to build, but I moved all the conditional logic into a function that generates the tags :)

ciaranmcnulty avatar Jun 10 '22 09:06 ciaranmcnulty

Just checking in if this will be on the roadmap anytime soon? thanks 😄

c-ameron avatar May 23 '23 09:05 c-ameron

+1 on this, perhaps another solution would be to add some kind of directive that indicates "this target does not need to be pushed"

asgrim avatar May 24 '23 07:05 asgrim