From 140fc2361cf8f885b04c38fa44cd9b97451bcdf5 Mon Sep 17 00:00:00 2001 From: Fred Reinink Date: Mon, 28 Jul 2025 23:49:06 -0700 Subject: [PATCH] Allow enabling the circuit breaker with a command line flag --- workhorse/_support/lint_last_known_acceptable.txt | 6 +++--- workhorse/cmd/gitlab-workhorse/main.go | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/workhorse/_support/lint_last_known_acceptable.txt b/workhorse/_support/lint_last_known_acceptable.txt index fda475698a0cdf..e535b2565658f4 100644 --- a/workhorse/_support/lint_last_known_acceptable.txt +++ b/workhorse/_support/lint_last_known_acceptable.txt @@ -1,8 +1,8 @@ cmd/gitlab-workhorse/config_test.go:191: cmd/gitlab-workhorse/config_test.go:191: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "TODO this is meant to be 50*time.Second ..." (godox) cmd/gitlab-workhorse/listener.go:26:16: G402: TLS MinVersion too low. (gosec) -cmd/gitlab-workhorse/main.go:73: Function 'buildConfig' has too many statements (64 > 40) (funlen) -cmd/gitlab-workhorse/main.go:194: Function 'run' has too many statements (59 > 40) (funlen) -cmd/gitlab-workhorse/main.go:290:10: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) +cmd/gitlab-workhorse/main.go:73: Function 'buildConfig' has too many statements (65 > 40) (funlen) +cmd/gitlab-workhorse/main.go:195: Function 'run' has too many statements (59 > 40) (funlen) +cmd/gitlab-workhorse/main.go:291:10: G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server (gosec) internal/ai_assist/duoworkflow/actions.go:79:24: G115: integer overflow conversion int -> int32 (gosec) internal/ai_assist/duoworkflow/client.go:56:73: G402: TLS MinVersion too low. (gosec) internal/api/channel_settings.go:57:28: G402: TLS MinVersion too low. (gosec) diff --git a/workhorse/cmd/gitlab-workhorse/main.go b/workhorse/cmd/gitlab-workhorse/main.go index 6703861f7f812d..039d8d94947552 100644 --- a/workhorse/cmd/gitlab-workhorse/main.go +++ b/workhorse/cmd/gitlab-workhorse/main.go @@ -111,6 +111,7 @@ func buildConfig(arg0 string, args []string) (*bootConfig, *config.Config, error fset.DurationVar(&cfg.APIQueueTimeout, "apiQueueDuration", queueing.DefaultTimeout, "Maximum queueing duration of requests") fset.DurationVar(&cfg.APICILongPollingDuration, "apiCiLongPollingDuration", 50, "Long polling duration for job requesting for runners") fset.BoolVar(&cfg.PropagateCorrelationID, "propagateCorrelationID", false, "Reuse existing Correlation-ID from the incoming request header `X-Request-ID` if present") + fset.BoolVar(&cfg.CircuitBreakerConfig.Enabled, "circuitBreakerEnabled", false, "Enables the circuit breaker - overridden if specified in the config file") if err := fset.Parse(args); err != nil { return nil, nil, alreadyPrintedError{err} -- GitLab