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

Option to only tag images at end of bake #1089

Open
ciaranmcnulty opened this issue May 2, 2022 · 3 comments · May be fixed by #1197
Open

Option to only tag images at end of bake #1089

ciaranmcnulty opened this issue May 2, 2022 · 3 comments · May be fixed by #1197
Assignees

Comments

@ciaranmcnulty
Copy link

Currently bake --push will tag images in the remote registry as they are completed. This can be an issue if later images in the same high-level build error out.

Either the default behaviour could change, or a CLI option could be added that forces tagging to only happen at the end - I don't think pushing new layers would need to be held back.

This example results in a foo tag but not the bar one:

FROM alpine:3.15 as foo
FROM alpine:3.15 as bar
RUN sleep 30 && exit 1
group "default" {
  targets = ["foo", "bar"]
}

target "foo" {
  target = "foo"
  tags = [
    "ciaranmcnulty/test:foo"
  ]
}

target "bar" {
  target = "bar"
  tags = [
    "ciaranmcnulty/test:bar"
  ]
}
@ciaranmcnulty
Copy link
Author

This has come up today with bake-action, and I've ended up with this:

      -
        name: Build 
        uses: docker/bake-action@master

      -
        name: Build and push
        uses: docker/bake-action@master
        with:
          push: true

My issue is I RUN some tests at the end of the build and don't feel much need to do further testing before pushing, but if an individual image fails some may have already been pushed

@jedevc jedevc self-assigned this Jul 4, 2022
@jedevc jedevc linked a pull request Jul 5, 2022 that will close this issue
@ciaranmcnulty
Copy link
Author

An additional issue this can cause is where one target does a file output to a location that is the build context for a separate target.

If they're queueing it's currently possible for the files to be written out from the first target to FS, and then they are COPYed into the later target.

This is slightly unexpected, I think most users would expect the 'reads' to be based on the FS before the bake starts

@berney
Copy link

berney commented Apr 29, 2023

A workaround is to push with different names or even registry, do the testing, and then if testing passes, publish the images under the release names. So if some images don't build, then even though some got pushed, they are test images, and the CI won't move to publish them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants