Skip to content

Commit

Permalink
Reintroduce main build failure slacking
Browse files Browse the repository at this point in the history
Signed-off-by: mnokka-unikie <[email protected]>
  • Loading branch information
mnokka-unikie committed Dec 2, 2024
1 parent b6fcba9 commit 06c341c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 5 additions & 5 deletions ghaf-main-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pipeline {
dir(WORKDIR) {
script {
utils.nix_eval_jobs(targets)
target_jobs = utils.create_parallel_stages(targets)
target_jobs = utils.create_parallel_stages(targets,false,failedTargets)
}
}
}
Expand All @@ -139,15 +139,15 @@ pipeline {
if (failedTargets) {
formattedFailedMessage = failedTargets.collect { "- ${it.trim()}" }.join("\n")
} else {
formattedFailedMessage = "None, builds were ok, maybe HW tests failed?"
formattedFailedMessage = "No failed build targets"
}
if (servername=="ghaf-jenkins-controller-prod") {
serverchannel="ghaf-build" // prod main build failures channel
echo "Slack channel:$serverchannel"
line1="*FAILURE:* ${env.BUILD_URL}".stripIndent()
line2="\n*Failed Targets:*".stripIndent()
line3="\n${formattedFailedMessage}".stripIndent()
line4="\n*Commit*: <${githublink}|${env.TARGET_COMMIT}>".stripIndent()
line2="\nCommit: <${githublink}|${env.TARGET_COMMIT}>".stripIndent()
line3="\n*Failed build targets:*".stripIndent()
line4="\n${formattedFailedMessage}".stripIndent()
message = """
${line1}
${line2}
Expand Down
12 changes: 8 additions & 4 deletions utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,17 @@ def nix_eval_hydrajobs(List<Map> targets) {
}
}

def create_parallel_stages(List<Map> targets, Boolean skip_hw_test=false) {

// , List failedTargets = []
def create_parallel_stages(List<Map> targets, Boolean skip_hw_test=false, List failedTargets = null) {
def target_jobs = [:]
targets.each {
def timestampBegin = ""
def timestampEnd = ""
def displayName = "${it.target} (${it.system})"
def targetAttr = "${it.system}.${it.target}"
def scsdir = "scs/${targetAttr}/scs"

def target = "${it.target}"
target_jobs[displayName] = {
stage("Build ${displayName}") {
def opts = ""
Expand All @@ -321,8 +323,7 @@ def create_parallel_stages(List<Map> targets, Boolean skip_hw_test=false) {
try {
if (it.error) {
error("Error in evaluation! ${it.error}")
}

}
timestampBegin = sh(script: "date +%s", returnStdout: true).trim()
sh "nix build -L ${it.drvPath}\\^* ${opts}"
timestampEnd = sh(script: "date +%s", returnStdout: true).trim()
Expand All @@ -338,6 +339,9 @@ def create_parallel_stages(List<Map> targets, Boolean skip_hw_test=false) {
} catch (Exception e) {
unstable("FAILED: ${displayName}")
currentBuild.result = "FAILURE"
if (failedTargets != null) {
failedTargets.add(target)
}
println "Error: ${e.toString()}"
}
}
Expand Down

0 comments on commit 06c341c

Please sign in to comment.