From c7bcc056442909e41a3d4b0b78483d31cdae3434 Mon Sep 17 00:00:00 2001 From: "L. Jiang" Date: Thu, 25 Dec 2025 20:53:30 +0800 Subject: [PATCH] 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 Signed-off-by: L. Jiang --- pkg/compose/build.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/compose/build.go b/pkg/compose/build.go index 6072ada2e0..36461cf32c 100644 --- a/pkg/compose/build.go +++ b/pkg/compose/build.go @@ -19,6 +19,7 @@ package compose import ( "context" "fmt" + "os" "strings" "time" @@ -91,7 +92,10 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opti } if len(serviceToBuild) == 0 { - logrus.Warn("No services to build") + // Add COMPOSE_BUILDKIT_WARN_NOBUILD=true environment variable to enable warning when no services are built + if utils.StringToBool(os.Getenv("COMPOSE_BUILDKIT_WARN_NOBUILD")) { + logrus.Warn("No services to build") + } return imageIDs, nil }