[AIROCMLIR-597][CI] Extract Jenkinsfile helpers into helpers/*.groovy and load them in a Bootstrap stage#2360
Conversation
… in a Bootstrap stage Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
6cacfd3 to
947e828
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the main CI pipeline definition by extracting Jenkinsfile helper logic into per-domain Groovy scripts under mlir/utils/jenkins/helpers/, then loading and wiring those helpers in a new Bootstrap stage. This reduces the size/complexity of the primary Jenkinsfile and centralizes shared helper logic to support future de-duplication with downstream/release pipelines.
Changes:
- Added a
Bootstrapstage that checks out SCM,load()s helper scripts, and wires cross-helper dependencies. - Moved helper methods out of
mlir/utils/jenkins/Jenkinsfileinto six domain-focused helper files. - Updated Jenkinsfile call sites to use namespaced helper handles (e.g.,
ciLogic.*,nodeUtils.*,scmUtils.*, etc.).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| mlir/utils/jenkins/Jenkinsfile | Removes inlined helpers, adds Bootstrap load/wiring, and updates call sites to namespaced helper objects. |
| mlir/utils/jenkins/helpers/scmUtils.groovy | Extracts SCM-related helpers (git health check, robust checkout). |
| mlir/utils/jenkins/helpers/nodeUtils.groovy | Extracts node health/Docker discovery logic and withHealthyNode() harness. |
| mlir/utils/jenkins/helpers/buildUtils.groovy | Extracts build helpers for rocMLIR + CK/MIGraphX. |
| mlir/utils/jenkins/helpers/testUtils.groovy | Extracts test/sweep/static-check/coverage helpers (includes the tail -n 1 fix). |
| mlir/utils/jenkins/helpers/reportUtils.groovy | Extracts report publication and perfDB archival helpers. |
| mlir/utils/jenkins/helpers/ciLogic.groovy | Extracts CI flow logic (labels/gating/splitting/failure classification/Teams notifications). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: bogdan-petkovic <bogdan.petkovic@htecgroup.com>
dorde-antic
left a comment
There was a problem hiding this comment.
lgtm, finally a cleaner Jenkinsfile :)
wait for all types of CI runs to be successful before merging
Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
…tification Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
…bogdan-petkovic/rocMLIR into bogdan-petkovic/jenkins-helpers-extract
Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
…nkins-helpers-extract # Conflicts: # mlir/utils/jenkins/Jenkinsfile
…nkins-helpers-extract # Conflicts: # mlir/utils/jenkins/Jenkinsfile
|
Reviewed the Jenkinsfile + 6 new helper files (1 Jenkinsfile, 6 helpers/*.groovy). The refactor cleanly extracts helpers per domain and wires them via |
|
Reviewed 7 files (Jenkinsfile + 6 helper modules under mlir/utils/jenkins/helpers/). Posted 0 inline comments (0 critical, 0 major, 0 minor). Verdict: APPROVE. This is a clean mechanical extraction of ~900 lines of helpers from Jenkinsfile (2012 -> 333 lines) into six domain-grouped .groovy files loaded by a new Bootstrap stage. Cross-helper handles are wired in Bootstrap (nodeUtils.scmUtils, testUtils.nodeUtils/buildUtils, and ciLogic. fan-out), and every call site in Jenkinsfile is correctly namespaced (e.g. ciLogic.setHeartbeat(), reportUtils.archivePerfDB() inside a script {} block). The two earlier Copilot findings on commit 947e828 (a |
…nkins-helpers-extract # Conflicts: # mlir/utils/jenkins/Jenkinsfile
umangyadav
left a comment
There was a problem hiding this comment.
Looks good. Make sure to test this out in Jenkins using PR CI, Nightly CI and weekly CI triggers
…nkins-helpers-extract # Conflicts: # mlir/utils/jenkins/Jenkinsfile
…uneMatrixRow Signed-off-by: bogdan-petkovic <bpetkovi@amd.com>
There was a problem hiding this comment.
Verdict: APPROVE -- submitted as COMMENT (automated reviews are advisory) · Findings: 0 (0 Critical, 0 Major, 0 Minor)
Scope
Mechanical refactor that extracts ~900 lines of Groovy helper methods out of mlir/utils/jenkins/Jenkinsfile (2012 → 1099 lines) into six per-domain files under mlir/utils/jenkins/helpers/ (scmUtils, nodeUtils, buildUtils, testUtils, reportUtils, ciLogic), loaded from a new Bootstrap stage via load() and consumed through namespaced handles wired together with @Field cross-helper references.
Findings
No blocking issues found.
Notes
- The two prior Copilot review findings appear addressed in the head commit:
- The
buildUtils.buildUtils.buildProject(...)typo flagged at the oldPrepare Performance Scriptssite is no longer present;ciLogic.runParameterSweepsMatrixRownow invokesbuildUtils.buildProject('check-rocmlir-build-only ci-performance-scripts', '')with a single-level handle. reportUtils.archivePerfDB()is now wrapped inscript { ... }inside theArchive weekly tuning perfDBstage'sstepsblock (Jenkinsfile lines 239–241), so the Groovy method call is no longer issued directly to Declarative steps.
- The
- Cross-helper handles are declared with
@Fieldin each consumer file (nodeUtils.scmUtils,testUtils.{nodeUtils,buildUtils},ciLogic.{scmUtils,nodeUtils,buildUtils,testUtils,reportUtils}) and all of them are populated in the Bootstrap stage — no dangling references. - Bare
setHeartbeat()calls insideciLogic.groovy(e.g. lines 652, 718) resolve correctly because they target methods on the same loaded script object. - The intentional
tail -1l→tail -n 1shell fix intestUtils.collectCoverageDatais present and matches the PR description. - Pre-existing issues (out of scope):
ciLogic.shouldRunBuildAndTest(...)falls off the end without an explicitreturn falsewhenparams.codepathis neither"default"nor equal tocodepath; this implicit-null behavior was inherited fromdevelop.ciLogic.setHeartbeat()wraps its body in ascript { }step (a Declarative-only construct), also inherited verbatim. Neither was introduced by this PR; consider a follow-up cleanup. - The Bootstrap stage pins an
mlir-labelled executor forcheckout scm+load; the inline comment explains the rationale and the per-matrix stages still allocate their own agents throughnodeUtils.withHealthyNode.
CI status
Python format and lint checks, Python performance script tests, and detect are green. C/C++ premerge checks is still in-progress on the pinned SHA — not a failure.
…nkins-helpers-extract Signed-off-by: bogdan-petkovic <bpetkovi@amd.com> # Conflicts: # mlir/utils/jenkins/Jenkinsfile
…nkins-helpers-extract Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # mlir/utils/jenkins/Jenkinsfile
Motivation
The primary
mlir/utils/jenkins/Jenkinsfilehas grown to ~2000 lines, the majority of which are helper functions defined at the top of the file. This makes the actual pipeline definition hard to read and to navigate, and forces the same helpers to be duplicated acrossJenkinsfile.downstreamandJenkinsfile.release(see the// ON CHANGING THESE, ALSO CHANGE Jenkinsfile.downstreammarkers). Extracting the helpers into a shared location is the first step toward eliminating that duplication.Two earlier attempts addressed this problem but neither was merged:
vars/directory at the repo root. Clean per-domain separation, but the implicit-Shared-Library mechanism requires the Jenkins controller to be configured with a Global Pipeline Library.PipelineHelpers.groovyand loaded it from aBootstrapstage. Fully self-contained, but consolidates ~2000 lines into one file, which keeps the original navigability problem.This PR combines the strengths of both: it adopts CI: Refactor Jenkinsfile helpers into implicit Shared Library #2092's per-domain file split (helpers grouped by purpose into separate files) and [AIROCMLIR-597][CI] Create PipelineHelpers and load them in Jenkinsfile via Bootstrap stage #2276's
load()-from-Bootstraploading mechanism.Technical Details
mlir/utils/jenkins/helpers/directory with six files:scmUtils,nodeUtils,buildUtils,testUtils,reportUtils,ciLogic— 37 helpers total.Bootstrapstage inJenkinsfiledoescheckout scm,loads each helper file, and wires cross-helper handles via@Field(
nodeUtils.scmUtils,testUtils.nodeUtils,testUtils.buildUtils).Jenkinsfileare namespaced (e.g.ciLogic.setHeartbeat()).Jenkinsfile: 2012 → 1099 lines.developexcept the cross-helper namespace prefixes and one deliberate shell bug fix intestUtils.collectCoverageData, per Copilot review on PR [AIROCMLIR-597][CI] Create PipelineHelpers and load them in Jenkinsfile via Bootstrap stage #2276 ([AIROCMLIR-597][CI] Create PipelineHelpers and load them in Jenkinsfile via Bootstrap stage #2276 (review)):Test Plan
mfmanavi21navi3xnavi4xvanillagfx950Test Result
Submission Checklist