fix: less fussy catalogue generation
continuous-integration/drone/push Build is passing Details

This commit is contained in:
3wc 2021-11-24 13:47:16 +02:00
parent d1526fad21
commit 759a00eeb3
2 changed files with 17 additions and 4 deletions

View File

@ -178,7 +178,7 @@ A new catalogue copy can be published to the recipes repository by passing the
features, category, err := catalogue.GetRecipeFeaturesAndCategory(recipeMeta.Name) features, category, err := catalogue.GetRecipeFeaturesAndCategory(recipeMeta.Name)
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Warn(err)
} }
catl[recipeMeta.Name] = catalogue.RecipeMeta{ catl[recipeMeta.Name] = catalogue.RecipeMeta{

View File

@ -411,7 +411,7 @@ func GetImageMetadata(imageRowString string) (image, error) {
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
img.Image = imageName img.Image = strings.ReplaceAll(imageName, "`", "")
imageURL, err := GetStringInBetween(imgString, "(", ")") imageURL, err := GetStringInBetween(imgString, "(", ")")
if err != nil { if err != nil {
@ -441,7 +441,7 @@ func GetRecipeFeaturesAndCategory(recipeName string) (features, string, error) {
"<!-- metadata -->", "<!-- endmetadata -->", "<!-- metadata -->", "<!-- endmetadata -->",
) )
if err != nil { if err != nil {
logrus.Fatal(err) return feat, category, err
} }
readmeLines := strings.Split( // Array item from lines readmeLines := strings.Split( // Array item from lines
@ -553,9 +553,22 @@ func GetRecipeVersions(recipeName string) (RecipeVersions, error) {
path = strings.Split(path, "/")[1] path = strings.Split(path, "/")[1]
} }
var tag string
switch img.(type) {
case reference.NamedTagged:
tag = img.(reference.NamedTagged).Tag()
case reference.Named:
logrus.Warnf("%s service is missing image tag?", path)
continue
}
logrus.Debugf("looking up image: '%s' from '%s'", img, path)
digest, err := client.GetTagDigest(img) digest, err := client.GetTagDigest(img)
if err != nil { if err != nil {
return err // return err
logrus.Warn(err)
continue
} }
versionMeta[service.Name] = ServiceMeta{ versionMeta[service.Name] = ServiceMeta{