Skip to content

Commit 72a7794

Browse files
authored
1 parent 96ef348 commit 72a7794

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

buildkite/bazel-central-registry/bcr_presubmit.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -449,12 +449,20 @@ def should_wait_bcr_maintainer_review(modules):
449449

450450

451451
def upload_jobs_to_pipeline(pipeline_steps):
452-
"""Directly calling the buildkite-agent to upload steps."""
453-
subprocess.run(
454-
["buildkite-agent", "pipeline", "upload"],
455-
input=yaml.dump({"steps": pipeline_steps}).encode(),
456-
check=True,
457-
)
452+
"""Upload jobs to Buildkite in batches."""
453+
BATCH_SIZE = 2000
454+
for i in range(0, len(pipeline_steps), BATCH_SIZE):
455+
batch = pipeline_steps[i:i + BATCH_SIZE]
456+
# Upload the batch to Buildkite
457+
bazelci.eprint(f"Uploading batch {i // BATCH_SIZE + 1} of {len(pipeline_steps) // BATCH_SIZE + 1}")
458+
try:
459+
subprocess.run(
460+
["buildkite-agent", "pipeline", "upload"],
461+
input=yaml.dump({"steps": batch}).encode(),
462+
check=True,
463+
)
464+
except subprocess.CalledProcessError as e:
465+
error(f"Failed to upload batch {i // BATCH_SIZE + 1} to Buildkite: {e}")
458466

459467

460468
def main(argv=None):

0 commit comments

Comments
 (0)