Skip to content

Commit

Permalink
Fix failed HW test link
Browse files Browse the repository at this point in the history
Fix failed hw test build link added
to calling build description.

Add BAT tests to ghaf-main-pipeline

Signed-off-by: Ville-Pekka Juntunen <[email protected]>
  • Loading branch information
vjuntunen committed Oct 18, 2024
1 parent af25e7c commit e8d4cc1
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
2 changes: 1 addition & 1 deletion ghaf-hw-test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ pipeline {
} else if(params.DEVICE_CONFIG_NAME == "orin-nx") {
env.DEVICE_NAME = 'OrinNX1'
} else if(params.DEVICE_CONFIG_NAME == "lenovo-x1") {
env.DEVICE_NAME = 'LenovoX1-2'
env.DEVICE_NAME = 'LenovoX1-1'
} else if(params.DEVICE_CONFIG_NAME == "nuc") {
env.DEVICE_NAME = 'NUC1'
} else if(params.DEVICE_CONFIG_NAME == "riscv") {
Expand Down
27 changes: 14 additions & 13 deletions ghaf-main-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ def flakeAttr = ".#hydraJobs"

// Target names must be direct children of the above
def targets = [
[ target: "docs.aarch64-linux",
[ target: "docs.aarch64-linux",
hwtest_device: null ],
[ target: "docs.x86_64-linux",
[ target: "docs.x86_64-linux",
hwtest_device: null ],
[ target: "generic-x86_64-debug.x86_64-linux",
[ target: "generic-x86_64-debug.x86_64-linux",
hwtest_device: "nuc" ],
[ target: "lenovo-x1-carbon-gen11-debug.x86_64-linux",
[ target: "lenovo-x1-carbon-gen11-debug.x86_64-linux",
hwtest_device: "lenovo-x1" ],
[ target: "microchip-icicle-kit-debug-from-x86_64.x86_64-linux",
[ target: "microchip-icicle-kit-debug-from-x86_64.x86_64-linux",
hwtest_device: null ],
[ target: "nvidia-jetson-orin-agx-debug.aarch64-linux",
[ target: "nvidia-jetson-orin-agx-debug.aarch64-linux",
hwtest_device: "orin-agx" ],
[ target: "nvidia-jetson-orin-agx-debug-from-x86_64.x86_64-linux",
[ target: "nvidia-jetson-orin-agx-debug-from-x86_64.x86_64-linux",
hwtest_device: "orin-agx" ],
[ target: "nvidia-jetson-orin-nx-debug.aarch64-linux",
[ target: "nvidia-jetson-orin-nx-debug.aarch64-linux",
hwtest_device: "orin-nx" ],
[ target: "nvidia-jetson-orin-nx-debug-from-x86_64.x86_64-linux",
[ target: "nvidia-jetson-orin-nx-debug-from-x86_64.x86_64-linux",
hwtest_device: "orin-nx" ],
]

Expand All @@ -48,6 +48,7 @@ pipeline {
pollSCM('* * * * *')
}
options {
disableConcurrentBuilds()
timestamps ()
buildDiscarder(logRotator(numToKeepStr: '100'))
}
Expand Down Expand Up @@ -76,7 +77,7 @@ pipeline {
// nix-eval-jobs is used to evaluate the given flake attribute, and output target information into jobs.json
sh "nix-eval-jobs --gc-roots-dir gcroots --flake ${flakeAttr} --force-recurse > jobs.json"

// jobs.json is parsed using jq. target's name and derivation path are appended as space separated row into jobs.txt
// jobs.json is parsed using jq. target's name and derivation path are appended as space separated row into jobs.txt
sh "jq -r '.attr + \" \" + .drvPath' < jobs.json > jobs.txt"

targets.each {
Expand Down Expand Up @@ -107,16 +108,16 @@ pipeline {
println "Error: ${e.toString()}"
}
}

if (it['hwtest_device'] != null) {
stage("Archive ${target}") {
script {
utils.archive_artifacts("archive", target)
}
}
}

stage("Test ${target}") {
utils.ghaf_parallel_hw_test(target, it['hwtest_device'])
utils.ghaf_parallel_hw_test(target, it['hwtest_device'], '_boot_bat_')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion ghaf-parallel-hw-test.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pipeline {
stage('Checkout') {
steps {
checkout scmGit(
branches: [[name: 'switchbot']],
branches: [[name: 'main']],
extensions: [cleanBeforeCheckout()],
userRemoteConfigs: [[url: REPO_URL]]
)
Expand Down
18 changes: 9 additions & 9 deletions utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,16 @@ def ghaf_parallel_hw_test(String flakeref, String device_config, String testset=
return
}
// Compose the image URL; testagent will need this URL to download the image
imgdir = find_img_relpath(flakeref, 'archive')
remote_path = "artifacts/${env.ARTIFACTS_REMOTE_PATH}"
img_url = "${env.JENKINS_URL}/${remote_path}/${imgdir}"
build_url = "${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}"
build_href = "<a href=\"${build_url}\">${env.JOB_NAME}#${env.BUILD_ID}</a>"
flakeref_trimmed = "${flakeref_trim(flakeref)}"
description = "Triggered by ${build_href}<br>(${flakeref_trimmed})"
def imgdir = find_img_relpath(flakeref, 'archive')
def remote_path = "artifacts/${env.ARTIFACTS_REMOTE_PATH}"
def img_url = "${env.JENKINS_URL}/${remote_path}/${imgdir}"
def build_url = "${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}"
def build_href = "<a href=\"${build_url}\">${env.JOB_NAME}#${env.BUILD_ID}</a>"
def flakeref_trimmed = "${flakeref_trim(flakeref)}"
def description = "Triggered by ${build_href}<br>(${flakeref_trimmed})"
// Trigger a build in 'ghaf-parallel-hw-test' pipeline.
// 'build' step is documented in https://plugins.jenkins.io/pipeline-build-step/
job = build(
def job = build(
job: "ghaf-parallel-hw-test",
propagate: false,
parameters: [
Expand All @@ -291,7 +291,7 @@ def ghaf_parallel_hw_test(String flakeref, String device_config, String testset=
unstable("FAILED: ${device_config} ${testset}")
currentBuild.result = "FAILURE"
// Add a link to failed test job(s) on the calling pipeline
test_href = "<a href=\"${job.absoluteUrl}\">⛔ ${flakeref_trimmed}</a>"
def test_href = "<a href=\"${job.absoluteUrl}\">⛔ ${flakeref_trimmed}</a>"
currentBuild.description = "${currentBuild.description}<br>${test_href}"
}
// Copy test results from agent to controller to 'test-results' directory
Expand Down

0 comments on commit e8d4cc1

Please sign in to comment.