diff --git a/cli/recipe/recipe.go b/cli/recipe/recipe.go index 509685938..388ba7189 100644 --- a/cli/recipe/recipe.go +++ b/cli/recipe/recipe.go @@ -7,6 +7,7 @@ import ( "path" "sort" "strconv" + "strings" "text/template" "coopcloud.tech/abra/catalogue" @@ -183,6 +184,13 @@ var recipeUpgradeCommand = &cli.Command{ logrus.Fatal(err) } + if strings.Contains(image, "library") { + // ParseNormalizedNamed prepends 'library' to images like nginx:, + // postgres:, i.e. images which do not have a username in the + // first position of the string + image = strings.Split(image, "/")[1] + } + tag, err := tagcmp.Parse(img.(reference.NamedTagged).Tag()) if err != nil { logrus.Fatal(err) @@ -203,7 +211,7 @@ var recipeUpgradeCommand = &cli.Command{ if len(compatible) == 0 { logrus.Info(fmt.Sprintf("No new versions available for '%s', '%s' is the latest", image, tag)) - break + continue // skip on to the next tag and don't update any compose files } var compatibleStrings []string diff --git a/config/app.go b/config/app.go index b9697af7d..0801729f0 100644 --- a/config/app.go +++ b/config/app.go @@ -267,7 +267,14 @@ func UpdateAppComposeTag(recipe, image, tag string) error { if err != nil { logrus.Fatal(err) } + composeImage := reference.Path(img.(reference.Named)) + if strings.Contains(composeImage, "library") { + // ParseNormalizedNamed prepends 'library' to images like nginx:, + // postgres:, i.e. images which do not have a username in the + // first position of the string + composeImage = strings.Split(composeImage, "/")[1] + } composeTag := img.(reference.NamedTagged).Tag() if image == composeImage {