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