Manage job report for maven-parent.

This commit is contained in:
Manuele Simi 2019-12-09 15:49:33 -05:00
parent 1de672a7c5
commit 54b0bb03de
1 changed files with 30 additions and 6 deletions

36
Jenkinsfile vendored
View File

@ -156,12 +156,20 @@ pipeline {
// the maven-parent needs to be built (once) at each execution
stage('build maven-parent') {
steps {
echo build(job: 'maven-parent', wait: true,
parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_parent_file}"],
[$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"],
[$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']]
]).result
echo "Done with maven-parent"
script {
if ( ("${resume}" == 'true') && (wasSuccess('maven-parent')) ) {
// propagate success
sh "echo -e \\\"maven-parent,SUCCESS\\\">> $JOB_REPORT"
} else {
def gjob = build(job: 'maven-parent', wait: true, propagate: true,
parameters: [[$class: 'StringParameterValue', name: 'gcube_settings', value: "${maven_parent_file}"],
[$class: 'StringParameterValue', name: 'local_repo', value: "${maven_local_repo_path}"],
[$class: 'LabelParameterValue', name: 'exec_label', label: "CD", nodeEligibility: [$class: 'AllNodeEligibility']]
])
sh "echo -e \\\"maven-parent,${gjob.getResult()}\\\">> $JOB_REPORT"
echo "Done with maven-parent"
}
}
}
}
stage('build components') {
@ -227,4 +235,20 @@ def buildComponents(args, maven_settings_file, maven_local_repo_path) {
]
}
}
}
/**
Check if the job was successfully completed in teh given report.
*/
@NonCPS
boolean wasSuccess(job_name) {
boolean ret = false
new File("${agent_root_folder}/build_jobs.${env.BUILD_NUMBER -1}.csv").splitEachLine(',') { columns ->
if (job_name.equalsIgnoreCase(columns[0]) && columns[1].equalsIgnoreCase('SUCCESS')) {
ret = true
println "NAME: ${columns[0]} STATUS: ${columns[1]}"
return
}
}
ret;
}