Skip to content

Commit

Permalink
fix: only get stack info on delete if deleting images (#2937)
Browse files Browse the repository at this point in the history
* fix: only get stack info on delete if deleting images

* commit from cli-ci -- updated coverage

* revert mod

* commit from cli-ci -- updated coverage

---------

Co-authored-by: jakeyheath <[email protected]>
  • Loading branch information
jakeyheath and jakeyheath authored Jan 9, 2024
1 parent ca30025 commit e684dbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cli/COVERAGE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.82
20.81
16 changes: 8 additions & 8 deletions cli/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,17 @@ func runDelete(cmd *cobra.Command, stackName string) error {
}
}

stackInfo, err := stack.GetStackInfo(ctx)
if err != nil {
return errors.Wrap(err, "unable to get stack info")
}

// Delete the current ECR images if autocreate is not enabled
if !happyClient.HappyConfig.GetFeatures().EnableECRAutoCreation {
log.Debug("Deleting stack images")
err = happyClient.ArtifactBuilder.DeleteImages(ctx, stackInfo.StackMetadata.Tag)
stackInfo, err := stack.GetStackInfo(ctx)
if err != nil {
log.Error("Failed to delete stack images, please delete them manually")
log.Errorf("%s: unable to get stack info", err)
} else {
log.Debug("Deleting stack images")
err = happyClient.ArtifactBuilder.DeleteImages(ctx, stackInfo.StackMetadata.Tag)
if err != nil {
log.Error("Failed to delete stack images, please delete them manually")
}
}
}

Expand Down

0 comments on commit e684dbe

Please sign in to comment.