Skip to content

Commit 1f410d6

Browse files
committed
fix: restore safety-net defaults for build config zero values
Restore the safety-net checks that prevent zero values for MaxConcurrentBuilds and DefaultTimeout from reaching the build manager. These were removed in f00f60b, but are needed because a user who explicitly sets build.timeout: 0 or build.max_concurrent_source_builds: 0 in their YAML would get those zero values passed through koanf, bypassing the defaults. A zero concurrent-builds limit could starve the build queue, and a zero timeout could expire builds immediately.
1 parent f00f60b commit 1f410d6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/providers/providers.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,16 @@ func ProvideBuildManager(p *paths.Paths, cfg *config.Config, instanceManager ins
288288
RegistrySecret: cfg.JwtSecret, // Use same secret for registry tokens
289289
}
290290

291+
// Safety-net: ensure critical build config values are never zero, even if
292+
// explicitly set to 0 in YAML. A zero concurrent-builds limit would starve
293+
// the build queue, and a zero timeout would expire builds immediately.
294+
if buildConfig.MaxConcurrentBuilds == 0 {
295+
buildConfig.MaxConcurrentBuilds = 2
296+
}
297+
if buildConfig.DefaultTimeout == 0 {
298+
buildConfig.DefaultTimeout = 600
299+
}
300+
291301
// Configure secret provider (use NoOpSecretProvider as fallback to avoid nil panics)
292302
var secretProvider builds.SecretProvider
293303
if cfg.Build.SecretsDir != "" {

0 commit comments

Comments
 (0)