From d300e57f52082e9e92b88d864b2af9fdf1ccd0be Mon Sep 17 00:00:00 2001 From: Manuele Simi Date: Wed, 11 Dec 2019 23:41:19 -0500 Subject: [PATCH] Use NonCPS method to parse the jobs. --- Jenkinsfile | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c624133..7ba21d4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -138,17 +138,12 @@ pipeline { stage('resume') { steps { script { - sh 'cat ${PREVIOUS_JOB_REPORT}' content = readFile("${previous_report_file}") - println "CONTENT ${content}" - /*"${content}".splitEachLine(',') { columns -> - if (columns[0].startsWith('#') || columns[0].startsWith('JobName')) - return - jobs["${columns[0]}"] = columns[1] - } - for (job in jobs) - println job - */ + println "JOB REPORT CONTENT: ${content}" + jobs = parseJobs(content) + for (job in jobs) + println job + } } } @@ -287,15 +282,15 @@ def buildComponents(args, maven_settings_file, maven_local_repo_path, jobs) { @NonCPS def parseJobs(content) { def jobs = [:] - //try { - println content - content.splitEachLine(',') { columns -> - if (columns[0].startsWith('#') || columns[0].startsWith('JobName')) - return + try { + for (String line : content) { + if (!line.startsWith('#') && !line.startsWith('JobName')) { + def columns = line.split(',') jobs["${columns[0]}"] = columns[1] } - //} catch(Exception e) { - // println "Previous job report not available" - //} + } + } catch(Exception e) { + println "Previous job report not available" + } jobs; } \ No newline at end of file