feat: detect if tags are not parsable

This commit is contained in:
decentral1se 2021-08-10 07:57:23 +02:00
parent 210baf1905
commit e39c6a05be
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC

View File

@ -305,6 +305,7 @@ var recipeLintCommand = &cli.Command{
healthChecksForAllServices := true healthChecksForAllServices := true
allImagesTagged := true allImagesTagged := true
noUnstableTags := true noUnstableTags := true
semverLikeTags := true
for _, service := range compose.Services { for _, service := range compose.Services {
if service.Name == "app" { if service.Name == "app" {
serviceNamedApp = true serviceNamedApp = true
@ -326,10 +327,15 @@ var recipeLintCommand = &cli.Command{
allImagesTagged = false allImagesTagged = false
} }
if img.(reference.NamedTagged).Tag() == "latest" { tag := img.(reference.NamedTagged).Tag()
if tag == "latest" {
noUnstableTags = false noUnstableTags = false
} }
if !tagcmp.IsParsable(tag) {
semverLikeTags = false
}
if service.HealthCheck == nil { if service.HealthCheck == nil {
healthChecksForAllServices = false healthChecksForAllServices = false
} }
@ -344,6 +350,7 @@ var recipeLintCommand = &cli.Command{
table.Append([]string{"All services have a healthcheck enabled", strconv.FormatBool(healthChecksForAllServices)}) table.Append([]string{"All services have a healthcheck enabled", strconv.FormatBool(healthChecksForAllServices)})
table.Append([]string{"All images are using a tag", strconv.FormatBool(allImagesTagged)}) table.Append([]string{"All images are using a tag", strconv.FormatBool(allImagesTagged)})
table.Append([]string{"No usage of unstable 'latest' tags", strconv.FormatBool(noUnstableTags)}) table.Append([]string{"No usage of unstable 'latest' tags", strconv.FormatBool(noUnstableTags)})
table.Append([]string{"All tags are using a semver-like format", strconv.FormatBool(semverLikeTags)})
table.Render() table.Render()
return nil return nil