Move readFile to a dedicated stage.

This commit is contained in:
Manuele Simi 2019-12-11 23:08:47 -05:00
parent 71aeb70365
commit 9b8d767526
1 changed files with 15 additions and 6 deletions

21
Jenkinsfile vendored
View File

@ -71,16 +71,17 @@ if (verbose) {
}
def jobs = [:]
def previous_report_file = ''
if (resume_from) {
previous_report_file = "${agent_root_folder}/build_jobs.${resume_from}.csv"
def previous_report_content = ''
def previous_report_file = "${agent_root_folder}/build_jobs.${resume_from}.csv"
/*if (resume_from) {
echo "Previous report file: ${previous_report_file}"
jobs = parseJobs(previous_report_file)
if (verbose) {
for (job in jobs)
println job
}
}
}*/
pipeline {
@ -134,6 +135,15 @@ pipeline {
//see https://jenkins.io/doc/book/pipeline/syntax/#stages
stages {
stage('resume') {
steps {
sh 'cat ${PREVIOUS_JOB_REPORT}'
content = readFile ${PREVIOUS_JOB_REPORT}
jobs = parseJobs(content)
for (job in jobs)
println job
}
}
stage('initialize') {
steps {
sh '''
@ -269,10 +279,9 @@ def buildComponents(args, maven_settings_file, maven_local_repo_path, jobs) {
Loads the jobs from the given report.
*/
@NonCPS
def parseJobs(job_file) {
def parseJobs(content) {
def jobs = [:]
//try {
def content = readFile file:job_file
println content
content.splitEachLine(',') { columns ->
if (columns[0].startsWith('#') || columns[0].startsWith('JobName'))