Parse job report before the pipeline execution.

This commit is contained in:
Manuele Simi 2019-12-09 16:35:11 -05:00
parent f2298fff63
commit 517153a3ae
1 changed files with 14 additions and 10 deletions

24
Jenkinsfile vendored
View File

@ -70,6 +70,12 @@ if (verbose) {
jsonConfig.gCube_release.Components.each { println it.key } jsonConfig.gCube_release.Components.each { println it.key }
} }
def jobs = parseJobs("${agent_root_folder}/build_jobs.${env.BUILD_NUMBER -1}.csv")
for (job in jobs) {
println "$job"
}
pipeline { pipeline {
// see https://jenkins.io/doc/book/pipeline/syntax/#agent // see https://jenkins.io/doc/book/pipeline/syntax/#agent
@ -157,7 +163,7 @@ pipeline {
stage('build maven-parent') { stage('build maven-parent') {
steps { steps {
script { script {
if ( ("${resume}" == 'true') && (wasSuccess('maven-parent')) ) { if ( ("${resume}" == 'true') && (jobs['maven-parent'] == 'SUCCESS') ) {
// propagate success // propagate success
sh "echo -e \\\"maven-parent,SUCCESS\\\">> $JOB_REPORT" sh "echo -e \\\"maven-parent,SUCCESS\\\">> $JOB_REPORT"
} else { } else {
@ -242,14 +248,12 @@ def buildComponents(args, maven_settings_file, maven_local_repo_path) {
Check if the job was successfully completed in teh given report. Check if the job was successfully completed in teh given report.
*/ */
@NonCPS @NonCPS
boolean wasSuccess(job_name) { def parseJobs(job_file) {
boolean ret = false def jobs = [:]
new File("${agent_root_folder}/build_jobs.${env.BUILD_NUMBER -1}.csv").splitEachLine(',') { columns -> new File(job_file).splitEachLine(',') { columns ->
if (job_name.equalsIgnoreCase(columns[0]) && columns[1].equalsIgnoreCase('SUCCESS')) { if (columns[0].startsWith('#') || columns[0].startsWith('GroupID'))
ret = true return
println "NAME: ${columns[0]} STATUS: ${columns[1]}" jobs["${columns[0]}"] = columns[1]
return
}
} }
ret; jobs;
} }