Skip to content

Jenkinsfile: throttle concurrent builds - #1782

Merged
val-ms merged 1 commit into
Cisco-Talos:mainfrom
val-ms:throttle-concurrent-builds-first-run
Aug 12, 2026
Merged

Jenkinsfile: throttle concurrent builds#1782
val-ms merged 1 commit into
Cisco-Talos:mainfrom
val-ms:throttle-concurrent-builds-first-run

Conversation

@val-ms

@val-ms val-ms commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This replaces #1780 with runtime throttling that also covers the first build of a newly discovered multibranch job.

A Jenkinsfile-defined throttleJobProperty is not present when Jenkins queues the first run of a new branch or pull-request job. Consequently, that first run can bypass the global category limit, as described in jenkinsci/throttle-concurrent-builds-plugin#448.

Use the plugin's runtime throttle() step instead. The pipeline now has no top-level agent. A parent sequential stage named ClamAV pipeline enters throttle(['clamav']) before allocating the existing default agent, then runs the existing Generate Tarball, Build, and Tests stages within that agent and throttle scope.

This structure holds one category slot for the complete orchestration run, preserves the existing internal Tests parallelism, and prevents first runs from acquiring an executor while another ClamAV orchestration run is active.

Validation:

  • git diff --check
  • Confirmed the branch contains one commit changing only Jenkinsfile
  • Matched the plugin's tested Declarative first-run pattern: top-level agent none, then stage-level agent and options { throttle(...) }
  • Used Jenkins-supported sequential nested stages so the throttle remains active for the whole run
  • Confirmed that no agent is declared on the Tests stage containing parallel
  • Confirmed the obsolete throttleJobProperty is absent

The replacement PR intentionally uses a new head branch so Jenkins creates a new multibranch PR job and exercises first-run throttling.

Jenkinsfile-defined job properties are unavailable when Jenkins queues the first build of a newly discovered multibranch job. Use the runtime throttle step around agent allocation so first builds also observe the global clamav category.

Refs: jenkinsci/throttle-concurrent-builds-plugin#448
@val-ms
val-ms force-pushed the throttle-concurrent-builds-first-run branch from 191b6f1 to b5903f6 Compare July 29, 2026 16:19

val-ms commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Updated after Jenkins rejected an agent directly on the parallel Tests stage. The throttle and default agent now belong to a parent sequential stage containing all existing stages. This holds the throttle for the complete run while preserving the existing Tests parallelism. Jenkins build #2 has parsed the amended revision and is now pending.

@rsundriyal
rsundriyal self-requested a review August 12, 2026 18:34
@val-ms
val-ms merged commit 16cb181 into Cisco-Talos:main Aug 12, 2026
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants