fix: gracefully handle missing tag for syncing
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
cellarspoon 2022-01-05 18:04:46 +01:00
parent d7cf11b876
commit d9f3a11265
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410

View File

@ -127,6 +127,7 @@ your SSH keys configured on your account.
func getImageVersions(recipe recipe.Recipe) (map[string]string, error) {
var services = make(map[string]string)
missingTag := false
for _, service := range recipe.Config.Services {
if service.Image == "" {
continue
@ -146,12 +147,19 @@ func getImageVersions(recipe recipe.Recipe) (map[string]string, error) {
case reference.NamedTagged:
tag = img.(reference.NamedTagged).Tag()
case reference.Named:
return services, fmt.Errorf("%s service is missing image tag?", path)
if service.Name == "app" {
missingTag = true
}
continue
}
services[path] = tag
}
if missingTag {
return services, fmt.Errorf("app service is missing image tag?")
}
return services, nil
}