Skip to content

Commit

Permalink
Set build description in boot test pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: Henri Rosten <[email protected]>
  • Loading branch information
henrirosten committed Jun 26, 2024
1 parent ad2e678 commit 8249478
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ghaf-test-boot.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,23 @@ pipeline {
}
}
}
stage('Set description') {
steps {
script {
if(!params.containsKey('DESC')) {
println "Missing DESC parameter, skip setting description"
} else {
currentBuild.description = "${params.DESC}"
}
}
}
}
stage('Image download') {
steps {
script {
if (!params.containsKey('IMG_URL')) {
if(!params.containsKey('IMG_URL')) {
println "Missing IMG_URL parameter"
exit 1
sh "exit 1"
}
sh "rm -fr ${TMP_IMG_DIR}"
sh "wget -nv --show-progress --progress=dot:giga -P ${TMP_IMG_DIR} ${params.IMG_URL}"
Expand All @@ -62,7 +73,7 @@ pipeline {
script {
if(!params.getOrDefault('DEVICE_CONFIG_NAME', null)) {
println "Missing DEVICE_CONFIG_NAME parameter"
exit 1
sh "exit 1"
}
mount_cmd = unmount_cmd = devstr = null
if(["orin-agx"].contains(params.DEVICE_CONFIG_NAME)) {
Expand Down
6 changes: 6 additions & 0 deletions utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ def boot_test(String flakeref, String device_config, String jenkins_url, String
imgdir = find_img_relpath(flakeref, subdir)
remote_path = "artifacts/${env.ARTIFACTS_REMOTE_PATH}"
img_url = "${jenkins_url}/${remote_path}/${imgdir}"
build_url = "${jenkins_url}/job/${env.JOB_NAME}/${env.BUILD_ID}"
build_href = "<a href=\"${build_url}\">#${env.BUILD_ID}</a>"
// 'short' flakeref: everything after the last occurence of '.' (if any)
flakeref_short = flakeref_trim(flakeref).replaceAll(/.*\.+/,"")
description = "Triggered by upstream build ${build_href}<br>(${flakeref_short})"
// Trigger a build in 'ghaf-test-boot' pipeline.
// 'build' step is documented in https://plugins.jenkins.io/pipeline-build-step/
build(
Expand All @@ -171,6 +176,7 @@ def boot_test(String flakeref, String device_config, String jenkins_url, String
string(name: "LABEL", value: "testagent"),
string(name: "DEVICE_CONFIG_NAME", value: "$device_config"),
string(name: "IMG_URL", value: "$img_url"),
string(name: "DESC", value: "$description"),
],
wait: true,
)
Expand Down

0 comments on commit 8249478

Please sign in to comment.