Browse Source

warn user no service has been selected to build

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 2 weeks ago
parent
commit
c89b8a2d6b
1 changed files with 7 additions and 1 deletions
  1. 7 1
      pkg/compose/build.go

+ 7 - 1
pkg/compose/build.go

@@ -61,6 +61,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
 
 	// also include services used as additional_contexts with service: prefix
 	options.Services = addBuildDependencies(options.Services, project)
+
 	// Some build dependencies we just introduced may not be enabled
 	var err error
 	project, err = project.WithServicesEnabled(options.Services...)
@@ -85,10 +86,15 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
 		serviceToBuild[serviceName] = *service
 		return nil
 	}, policy)
-	if err != nil || len(serviceToBuild) == 0 {
+	if err != nil {
 		return imageIDs, err
 	}
 
+	if len(serviceToBuild) == 0 {
+		logrus.Warn("No services to build")
+		return imageIDs, nil
+	}
+
 	bake, err := buildWithBake(s.dockerCli)
 	if err != nil {
 		return nil, err