fix: dont loop over dead tags
continuous-integration/drone/push Build is passing Details

Closes coop-cloud/organising#195.
This commit is contained in:
decentral1se 2021-10-12 00:56:52 +02:00
parent 6db1fdcfba
commit deb7d21158
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 8 additions and 5 deletions

View File

@ -13,7 +13,7 @@ import (
"coopcloud.tech/tagcmp"
"github.com/AlecAivazis/survey/v2"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/go-git/go-git/v5/plumbing"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
)
@ -209,14 +209,18 @@ or a rollback of an app.
// get the latest tag with its hash, name etc
var lastGitTag tagcmp.Tag
iter, err := repo.TagObjects()
iter, err := repo.Tags()
if err != nil {
logrus.Fatal(err)
}
if err := iter.ForEach(func(obj *object.Tag) error {
if err := iter.ForEach(func(ref *plumbing.Reference) error {
obj, err := repo.TagObject(ref.Hash())
if err != nil {
return err
}
tagcmpTag, err := tagcmp.Parse(obj.Name)
if err != nil {
logrus.Fatal(err)
return err
}
if (lastGitTag == tagcmp.Tag{}) {
lastGitTag = tagcmpTag
@ -224,7 +228,6 @@ or a rollback of an app.
lastGitTag = tagcmpTag
}
return nil
}); err != nil {
logrus.Fatal(err)
}