Skip to content

Commit

Permalink
Don't cleanup the ephemeral builder if it is the original builder
Browse files Browse the repository at this point in the history
Signed-off-by: Natalie Arellano <narellano@vmware.com>
  • Loading branch information
natalieparellano committed Jul 2, 2024
1 parent 55f7f36 commit 423f596
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/client/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,12 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
if err != nil {
return err
}
defer c.docker.ImageRemove(context.Background(), ephemeralBuilder.Name(), types.RemoveOptions{Force: true})
defer func() {
if ephemeralBuilder.Name() == rawBuilderImage.Name() {
return
}
_, _ = c.docker.ImageRemove(context.Background(), ephemeralBuilder.Name(), types.RemoveOptions{Force: true})

Check warning on line 530 in pkg/client/build.go

View check run for this annotation

Codecov / codecov/patch

pkg/client/build.go#L530

Added line #L530 was not covered by tests
}()

if len(bldr.OrderExtensions()) > 0 || len(ephemeralBuilder.OrderExtensions()) > 0 {
if targetToUse.OS == "windows" {
Expand Down

0 comments on commit 423f596

Please sign in to comment.