Skip to content

Commit 5cf4ad5

Browse files
committed
feat: conditionally warn when no services to build
- Add COMPOSE_BUILDKIT_WARN_NOBUILD environment variable support - Only show "No services to build" warning when variable is set to true - Prevent unnecessary warning output in default behavior
1 parent 59f04b8 commit 5cf4ad5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/compose/build.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package compose
1919
import (
2020
"context"
2121
"fmt"
22+
"os"
2223
"strings"
2324
"time"
2425

@@ -91,7 +92,10 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti
9192
}
9293

9394
if len(serviceToBuild) == 0 {
94-
logrus.Warn("No services to build")
95+
// Add COMPOSE_BUILDKIT_WARN_NOBUILD=true environment variable to enable warning when no services are built
96+
if utils.StringToBool(os.Getenv("COMPOSE_BUILDKIT_WARN_NOBUILD")) {
97+
logrus.Warn("No services to build")
98+
}
9599
return imageIDs, nil
96100
}
97101

0 commit comments

Comments
 (0)