fix: handle tags without images gracefully
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
74dfb12fd6
commit
1b37d2d5f5
|
@ -115,20 +115,20 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||
}
|
||||
logrus.Debugf("retrieved %s from remote registry for %s", regVersions, image)
|
||||
|
||||
if strings.Contains(image, "library") {
|
||||
// ParseNormalizedNamed prepends 'library' to images like nginx:<tag>,
|
||||
// postgres:<tag>, i.e. images which do not have a username in the
|
||||
// first position of the string
|
||||
image = strings.Split(image, "/")[1]
|
||||
}
|
||||
semverLikeTag := true
|
||||
if !tagcmp.IsParsable(img.(reference.NamedTagged).Tag()) {
|
||||
logrus.Debugf("%s not considered semver-like", img.(reference.NamedTagged).Tag())
|
||||
semverLikeTag = false
|
||||
image = recipePkg.StripTagMeta(image)
|
||||
|
||||
switch img.(type) {
|
||||
case reference.NamedTagged:
|
||||
if !tagcmp.IsParsable(img.(reference.NamedTagged).Tag()) {
|
||||
logrus.Debugf("%s not considered semver-like", img.(reference.NamedTagged).Tag())
|
||||
}
|
||||
default:
|
||||
logrus.Warnf("unable to read tag for image %s, is it missing? skipping upgrade for %s", image, service.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
tag, err := tagcmp.Parse(img.(reference.NamedTagged).Tag())
|
||||
if err != nil && semverLikeTag {
|
||||
if err != nil {
|
||||
logrus.Fatal(err)
|
||||
}
|
||||
logrus.Debugf("parsed %s for %s", tag, service.Name)
|
||||
|
@ -148,7 +148,7 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
|||
|
||||
sort.Sort(tagcmp.ByTagDesc(compatible))
|
||||
|
||||
if len(compatible) == 0 && semverLikeTag {
|
||||
if len(compatible) == 0 {
|
||||
logrus.Info(fmt.Sprintf("no new versions available for %s, %s is the latest", image, tag))
|
||||
continue // skip on to the next tag and don't update any compose files
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue