Skip to content

Commit c89b8a2

Browse files
committed
warn user no service has been selected to build
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent aec9f54 commit c89b8a2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/compose/build.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
6161

6262
// also include services used as additional_contexts with service: prefix
6363
options.Services = addBuildDependencies(options.Services, project)
64+
6465
// Some build dependencies we just introduced may not be enabled
6566
var err error
6667
project, err = project.WithServicesEnabled(options.Services...)
@@ -85,10 +86,15 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
8586
serviceToBuild[serviceName] = *service
8687
return nil
8788
}, policy)
88-
if err != nil || len(serviceToBuild) == 0 {
89+
if err != nil {
8990
return imageIDs, err
9091
}
9192

93+
if len(serviceToBuild) == 0 {
94+
logrus.Warn("No services to build")
95+
return imageIDs, nil
96+
}
97+
9298
bake, err := buildWithBake(s.dockerCli)
9399
if err != nil {
94100
return nil, err

0 commit comments

Comments
 (0)