fix: dont loop over dead tags
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Closes coop-cloud/organising#195.
This commit is contained in:
parent
6db1fdcfba
commit
deb7d21158
@ -13,7 +13,7 @@ import (
|
|||||||
"coopcloud.tech/tagcmp"
|
"coopcloud.tech/tagcmp"
|
||||||
"github.com/AlecAivazis/survey/v2"
|
"github.com/AlecAivazis/survey/v2"
|
||||||
"github.com/go-git/go-git/v5"
|
"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/sirupsen/logrus"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
@ -209,14 +209,18 @@ or a rollback of an app.
|
|||||||
|
|
||||||
// get the latest tag with its hash, name etc
|
// get the latest tag with its hash, name etc
|
||||||
var lastGitTag tagcmp.Tag
|
var lastGitTag tagcmp.Tag
|
||||||
iter, err := repo.TagObjects()
|
iter, err := repo.Tags()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
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)
|
tagcmpTag, err := tagcmp.Parse(obj.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Fatal(err)
|
return err
|
||||||
}
|
}
|
||||||
if (lastGitTag == tagcmp.Tag{}) {
|
if (lastGitTag == tagcmp.Tag{}) {
|
||||||
lastGitTag = tagcmpTag
|
lastGitTag = tagcmpTag
|
||||||
@ -224,7 +228,6 @@ or a rollback of an app.
|
|||||||
lastGitTag = tagcmpTag
|
lastGitTag = tagcmpTag
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
logrus.Fatal(err)
|
logrus.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user