chore(ci): lower concurrent jobs when pushing to dockerhub (#64469)

We're currently evaluating only pushing on Dockerhub when releasing, as
everything else uses GCR, but until then, we lower the concurrency to 4
when pushing there, and we keep 8 on the others.

Follow-up to https://github.com/sourcegraph/devx-support/issues/1163

## Test plan

CI
This commit is contained in:
Jean-Hadrien Chabran 2024-08-14 18:23:39 +02:00 committed by GitHub
parent 6e828b0a14
commit 1c3ba6eb85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -87,11 +87,15 @@ func bazelPushImagesCmd(c Config, isCandidate bool, opts ...bk.StepOpt) func(*bk
stepKey := "bazel-push-images"
candidate := ""
cloudEphemeral := ""
// Until we fix rate limiting with DockerHub, we use 4 to mitigate it.
jobConcurrency := 4
if isCandidate {
stepName = ":bazel::docker: Push candidate Images"
stepKey = stepKey + "-candidate"
candidate = "true"
// But when we're pushing candidate images, we're totally fine with 8.
jobConcurrency = 8
}
// Default registries.
devRegistry := images.SourcegraphDockerDevRegistry
@ -129,6 +133,7 @@ func bazelPushImagesCmd(c Config, isCandidate bool, opts ...bk.StepOpt) func(*bk
bk.Env("DEV_REGISTRY", devRegistry),
bk.Env("PROD_REGISTRY", prodRegistry),
bk.Env("ADDITIONAL_PROD_REGISTRIES", additionalProdRegistry),
bk.Env("PUSH_CONCURRENT_JOBS", fmt.Sprintf("%d", jobConcurrency)),
bk.AutomaticRetry(1),
bk.ArtifactPaths("build_event_log.bin", "execution_log.zstd", "bazel-profile.gz"),
bk.AnnotatedCmd(

View File

@ -214,7 +214,11 @@ echo "--- :bazel::docker: Pushing images..."
log_file=$(mktemp)
# shellcheck disable=SC2064
trap "rm -rf $log_file" EXIT
parallel --jobs=8 --line-buffer --joblog "$log_file" -v <"$job_file"
# See dev/ci/internal/ci/images_operations.go
JOBS="${PUSH_CONCURRENT_JOBS:-4}"
parallel --jobs="$JOBS" --line-buffer --joblog "$log_file" -v <"$job_file"
# Pretty print the output from gnu parallel
while read -r line; do