warn user no service has been selected to build

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof
2025-12-18 11:17:11 +01:00
committed by Nicolas De loof
parent aec9f54176
commit c89b8a2d6b

View File

@@ -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