Skip to content

Commit

Permalink
fix: Alert user when image field is not specified in docker-compose f…
Browse files Browse the repository at this point in the history
…ile (#2795)
  • Loading branch information
alexlokshin-czi authored Nov 28, 2023
1 parent 4c0d409 commit 1e93d7a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cli/COVERAGE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.10
22.14
2 changes: 1 addition & 1 deletion cli/pkg/artifact_builder/COVERAGE
Original file line number Diff line number Diff line change
@@ -1 +1 @@
53.5
53.6
6 changes: 6 additions & 0 deletions cli/pkg/artifact_builder/artifact_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ func (ab ArtifactBuilder) push(ctx context.Context, tags []string, servicesImage
}

image := servicesImage[serviceName]
parts := strings.Split(image, ":")

if len(parts) != 2 || len(strings.TrimSpace(parts[0])) == 0 {
return errors.Errorf("invalid image reference for service '%s': '%s'. Make sure docker-compose file has the image field specified for this service.", serviceName, image)
}

for _, currentTag := range tags {
// re-tag image
cmd := exec.CommandContext(ctx, "docker", "tag", image, fmt.Sprintf("%s:%s", registry.URL, currentTag))
Expand Down

0 comments on commit 1e93d7a

Please sign in to comment.