[rocm-libraries] ROCm/rocm-libraries#7990 (commit b8b5b43)

[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.
This commit is contained in:
Brock Hargreaves
2026-06-04 22:32:37 +00:00
committed by assistant-librarian[bot]
parent aef7b42883
commit 4e1296674d
2 changed files with 8 additions and 10 deletions

16
Jenkinsfile vendored
View File

@@ -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}"

View File

@@ -1412,5 +1412,3 @@ def runBuildInstancesOnly(String compiler) {
-D CMAKE_BUILD_TYPE=Release .. && ninja -j64"""
)
}
return this