Skip to content

Commit

Permalink
Mark pre-merge pipeline as failed if any target fails
Browse files Browse the repository at this point in the history
Signed-off-by: Joonas Rautiola <[email protected]>
  • Loading branch information
joinemm committed Sep 19, 2024
1 parent 949a33b commit 10026b9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ghaf-pre-merge-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,18 @@ pipeline {

target_jobs[target] = {
stage("${target}") {
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
try {
if (drvPath) {
sh "nix build -L ${drvPath}\\^*"
sh "nix build --no-link -L ${drvPath}\\^*"
} else {
error("Target \"${target}\" was not found in ${flakeAttr}")
}
} catch (InterruptedException e) {
throw e
} catch (Exception e) {
unstable("FAILED: ${target}")
currentBuild.result = "FAILURE"
println "Error: ${e.toString()}"
}
}
}
Expand Down

0 comments on commit 10026b9

Please sign in to comment.