Skip to content

Commit

Permalink
Convert coverage_details into a per-branch value
Browse files Browse the repository at this point in the history
Signed-off-by: Bence Szépkúti <[email protected]>
  • Loading branch information
bensze01 committed Jul 9, 2024
1 parent 7ce223e commit 60272b5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 4 additions & 0 deletions src/org/mbed/tls/jenkins/BranchInfo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ class BranchInfo {
final Set<String> failed_builds
final Set<String> outcome_stashes

/** Record coverage details for reporting */
String coverage_details

BranchInfo() {
this.all_all_sh_components = [:]
this.has_min_requirements = false
this.python_requirements_override_content = ''
this.python_requirements_override_file = ''
this.failed_builds = []
this.outcome_stashes = []
this.coverage_details = 'Code coverage job did not run'
}
}
7 changes: 4 additions & 3 deletions vars/common.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,14 @@ done
)
}

void send_email(String name, Collection<BranchInfo> infos, Map<String, String> coverage_details) {
void send_email(String name, Collection<BranchInfo> infos) {
String branches = infos*.branch.join(',')
def failed_builds = infos.collectMany { info -> info.failed_builds}
String coverage_details = infos.collect({info -> "$info.branch:\n$info.coverage_details"}).join('\n\n')
if (failed_builds) {
failures = failed_builds.join(", ")
emailbody = """
${coverage_details['coverage']}
$coverage_details
Logs: ${env.BUILD_URL}
Expand All @@ -381,7 +382,7 @@ Failures: ${failures}
recipients = env.TEST_FAIL_EMAIL_ADDRESS
} else {
emailbody = """
${coverage_details['coverage']}
$coverage_details
Logs: ${env.BUILD_URL}
"""
Expand Down
7 changes: 1 addition & 6 deletions vars/gen_jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,11 @@

import java.util.concurrent.Callable

import groovy.transform.Field

import net.sf.json.JSONObject
import hudson.AbortException

import org.mbed.tls.jenkins.BranchInfo

//Record coverage details for reporting
@Field coverage_details = ['coverage': 'Code coverage job did not run']

Map<String, Closure> job(String label, Closure body) {
return Collections.singletonMap(label, body)
}
Expand Down Expand Up @@ -473,7 +468,7 @@ fi

Closure post_success = {
String coverage_log = readFile('coverage-summary.txt')
coverage_details['coverage'] = coverage_log.substring(
info.coverage_details = coverage_log.substring(
coverage_log.indexOf('\nCoverage\n') + 1
)
}
Expand Down

0 comments on commit 60272b5

Please sign in to comment.