From 4e1296674da18bdf583cb244d31a63174e60af42 Mon Sep 17 00:00:00 2001 From: Brock Hargreaves <253123018+brockhargreaves-amd@users.noreply.github.com> Date: Thu, 4 Jun 2026 22:32:37 +0000 Subject: [PATCH] [rocm-libraries] ROCm/rocm-libraries#7990 (commit b8b5b43) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [CK] Load ck.groovy via Jenkins Shared Library MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Motivation This allows the CI service to have a configuration source-of-truth outside the PR under test, allowing rapid system changes. Bug fixes on the develop branch propagate immediately to all pipelines that don't override the parameter -- no rebase required. A new `USE_CURRENT_BRANCH_FOR_CK_GROOVY` parameter lets contributors test pipeline changes on their own branch without any extra configuration. ## Technical Details - `loadCk()` in the Jenkinsfile is updated to call `library("ck@${branch}").ck.get()` instead of `checkout scm` + `load "vars/ck.groovy"`. The `checkout scm` inside `loadCk()` is removed since Jenkins now handles the library fetch internally. - A `USE_CURRENT_BRANCH_FOR_CK_GROOVY` boolean parameter (default: off) is added. When off, `ck.groovy` is always loaded from `develop` — all normal PR builds are unaffected. When on, `ck.groovy` is loaded from the current branch automatically via `env.CHANGE_BRANCH`, so contributors testing pipeline changes just tick the box. - `return this` is removed from the end of `ck.groovy`. This was required by the `load` convention but is not needed (and can cause errors) in a shared library context. - `loadCk()` is kept at every call site rather than called once at the top, preserving restart-from-stage safety — if a build is restarted from a mid-pipeline stage, `ck` is still initialized correctly. - The Jenkins Shared Library named `"ck"` must be registered in Jenkins Global Pipeline Libraries ## Test Plan 1. Trigger "Build with Parameters" on the PR branch with `USE_CURRENT_BRANCH_FOR_CK_GROOVY=true` 2. Verify "Determine CI Execution" stage completes and the library() calls indicates the current branch 3. Verify "Static checks" stage completes. 4. Trigger a second build with `USE_CURRENT_BRANCH_FOR_CK_GROOVY=false` (default) to confirm normal builds still load from `develop`. ## Test Result Verified both paths. The develop library is loaded by default, the branch library is loaded when the parameter is enabled. ## Submission Checklist - [ X ] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests. --- Jenkinsfile | 16 ++++++++-------- vars/ck.groovy | 2 -- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d0308b7d07..a57f3432a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,19 +24,15 @@ // Benefits: PR builds 5h -> 30min (typical), nightly builds unchanged // See: script/dependency-parser/README.md for details // -ck = null - def rocmnode(name) { return '(rocmtest || miopen) && (' + name + ')' } def loadCk() { - if (ck == null) { - checkout scm - dir("projects/composablekernel") { - ck = load "vars/ck.groovy" - } - } + def branch = (params.USE_CURRENT_BRANCH_FOR_CK_GROOVY + ? (env.CHANGE_BRANCH ?: env.BRANCH_NAME) + : 'develop') + library("ck@${branch}") } //launch develop branch daily jobs @@ -256,6 +252,10 @@ pipeline { name: "FORCE_CI", defaultValue: false, description: "Force CI to run even when only non-relevant files are changed (default: OFF)") + booleanParam( + name: 'USE_CURRENT_BRANCH_FOR_CK_GROOVY', + defaultValue: false, + description: 'Load ck.groovy from the current branch instead of develop. Enable when testing pipeline changes (default: OFF).') } environment{ dbuser = "${dbuser}" diff --git a/vars/ck.groovy b/vars/ck.groovy index c97cfd81e3..1c16c43448 100644 --- a/vars/ck.groovy +++ b/vars/ck.groovy @@ -1412,5 +1412,3 @@ def runBuildInstancesOnly(String compiler) { -D CMAKE_BUILD_TYPE=Release .. && ninja -j64""" ) } - -return this