forked from coop-cloud/abra
fix: clean up if things go wrong
This commit is contained in:
parent
327c5adef2
commit
4c6d52c426
|
@ -129,6 +129,9 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||
}
|
||||
|
||||
if err := createReleaseFromTag(recipe, initTag, mainAppVersion); err != nil {
|
||||
if cleanUpErr := cleanUpTag(initTag, recipe.Name); err != nil {
|
||||
logrus.Fatal(cleanUpErr)
|
||||
}
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
@ -410,3 +413,20 @@ func createReleaseFromPreviousTag(tagString, mainAppVersion string, recipe recip
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// cleanUpTag removes a freshly created tag
|
||||
func cleanUpTag(tag, recipeName string) error {
|
||||
directory := path.Join(config.APPS_DIR, recipeName)
|
||||
repo, err := git.PlainOpen(directory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := repo.DeleteTag(tag); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
logrus.Warn("removed freshly created tag %s")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue