Skip to content

Commit

Permalink
Merge pull request #2260 from buildpacks/fix/delete-ephemeral-builder
Browse files Browse the repository at this point in the history
Fix deletion of ephemeral builder
  • Loading branch information
natalieparellano authored Sep 11, 2024
2 parents df70f4c + 97c9422 commit e545151
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/client/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
buildEnvs[k] = v
}

origBuilderName := rawBuilderImage.Name()
ephemeralBuilder, err := c.createEphemeralBuilder(
rawBuilderImage,
buildEnvs,
Expand All @@ -549,7 +550,7 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
return err
}
defer func() {
if ephemeralBuilder.Name() == rawBuilderImage.Name() {
if ephemeralBuilder.Name() == origBuilderName {
return
}
_, _ = c.docker.ImageRemove(context.Background(), ephemeralBuilder.Name(), types.RemoveOptions{Force: true})
Expand Down

0 comments on commit e545151

Please sign in to comment.