From 0a173b49c6b4dcb28b0523364cfd89450f0cc65d Mon Sep 17 00:00:00 2001 From: Manuele Simi Date: Thu, 12 Dec 2019 22:20:29 -0500 Subject: [PATCH] Append new jobs to the previous job report. --- Jenkinsfile | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4f0d326..12a0be3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -125,18 +125,33 @@ pipeline { //see https://jenkins.io/doc/book/pipeline/syntax/#stages stages { - stage('resume previous build?') { + stage('initialize reports') { steps { script { if (resume) { content = readFile("${previous_report_file}") println "JOB REPORT CONTENT: ${content}" jobs = parseJobs(content) + sh "cp ${PREVIOUS_JOB_REPORT} ${JOB_REPORT}" + } else { + sh "echo #Build ${PIPELINE_BUILD_NUMBER} > ${JOB_REPORT}" + sh "echo #StartTime ${date} >> ${JOB_REPORT}" + sh "echo -e JobName,Status >> ${JOB_REPORT}" } } + + sh ''' + #build report + echo "#Build ${PIPELINE_BUILD_NUMBER}" > ${AGENT_ROOT_FOLDER}/build_commits.csv + echo "#Release ${GCUBE_RELEASE_NUMBER}" >> ${AGENT_ROOT_FOLDER}/build_commits.csv + date=`date` + echo "#StartTime ${date}" >> ${AGENT_ROOT_FOLDER}/build_commits.csv + echo -e "GroupID,ArtifactID,Version,SCM URL,Build Number,Distribution URL,Filename,Packaging" >> ${AGENT_ROOT_FOLDER}/build_commits.csv + + ''' } } - stage('initialize') { + stage('initialize local repository') { steps { sh ''' echo "REMOVE_LOCAL_REPO: ${REMOVE_LOCAL_REPO}" @@ -154,17 +169,6 @@ pipeline { cp "${AGENT_ROOT_FOLDER}/${MAVEN_SETTINGS_FILE}" "${AGENT_ROOT_FOLDER}/settings.xml" echo "Done with local repository and settings" - #build report - echo "#Build ${PIPELINE_BUILD_NUMBER}" > ${AGENT_ROOT_FOLDER}/build_commits.csv - echo "#Release ${GCUBE_RELEASE_NUMBER}" >> ${AGENT_ROOT_FOLDER}/build_commits.csv - date=`date` - echo "#StartTime ${date}" >> ${AGENT_ROOT_FOLDER}/build_commits.csv - echo -e "GroupID,ArtifactID,Version,SCM URL,Build Number,Distribution URL,Filename,Packaging" >> ${AGENT_ROOT_FOLDER}/build_commits.csv - - #job report - echo "#Build ${PIPELINE_BUILD_NUMBER}" > ${JOB_REPORT} - echo "#StartTime ${date}" >> ${JOB_REPORT} - echo -e "JobName,Status" >> ${JOB_REPORT} ''' } }