Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce main build failure slacking #104

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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