diff --git a/Jenkinsfile b/Jenkinsfile index ac4177f..fb98f5a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -103,12 +103,6 @@ pipeline { string(name: 'RELEASE_URL', defaultValue: '', description: 'URL to the yaml file. Leave blank if executed outside gCube release.') - -// string(name: 'report', -// defaultValue: '', -// description: 'The build report. Leave blank to pull the build report from Git. Leave blank if executed outside gCube release.') - - } stages { @@ -163,21 +157,20 @@ pipeline { anyOf{ triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' + // this condition should be deleted. This is active only for testing purpose triggeredBy 'UserIdCause' } - expression { params.TRIGGER_JOB != 'gCubeBuilder' } + expression { params.TRIGGER_JOB != "${RELEASE_JOB}" } } steps { sh ''' - if [ "${TRIGGER_JOB}" != 'gCubeBuilder' ]; then - echo "Cron build enabled. New deploy of ${TRIGGER_JOB} - ${TRIGGER_VERSION} will be added to the pending deploy file" - touch $DEPLOY_FILE; - if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then - echo "component ${TRIGGER_JOB} already added. Nothing to add." - else - echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE} - fi - fi + echo "Cron build enabled. New deploy of ${TRIGGER_JOB} - ${TRIGGER_VERSION} will be added to the pending deploy file" + touch $DEPLOY_FILE; + if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then + echo "component ${TRIGGER_JOB} already added. Nothing to add." + else + echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE} + fi ''' // the following catch give always an error in order to return a feedback UNSTABLE to the final user since the deploy is still not performed catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') { @@ -197,18 +190,17 @@ pipeline { triggeredBy 'BuildUpstreamCause' triggeredBy 'UpstreamCause' } + expression { params.TRIGGER_JOB != "${RELEASE_JOB}" } } steps { script{ - if("${TRIGGER_JOB}" != 'gCubeBuilder'){ - echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" - ansiColor("xterm") { - catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { - checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); - deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); - } - } - } + echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" + ansiColor("xterm") { + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); + } + } } @@ -223,7 +215,7 @@ pipeline { triggeredBy 'UserIdCause' } // we should improve this conditional check - equals(actual: "${params.TRIGGER_JOB}", expected: 'gCubeBuilder') + equals(actual: "${params.TRIGGER_JOB}", expected: "${RELEASE_JOB}") } steps { script{ @@ -237,8 +229,6 @@ pipeline { } deployReleaseJobs(releaseList); } - - } } stage('Deploy manually ') { @@ -265,7 +255,6 @@ pipeline { sh ''' echo 'Sending report' ''' - //cat ./${ACTION_DEPLOY_FILE}.csv } } success { @@ -416,22 +405,3 @@ def deployReleaseJobs(def serviceList){ } } } - - - -def parseBuildComponents( def text){ - def components = [] - "${text}".splitEachLine(',') { columns -> - if (columns[0].startsWith('#') || columns[0].startsWith('GroupID')) - return - components.add([ - name : columns[1], - version : columns[2], - gitRepo : columns[3], - commitID: columns[4] - ] - ) - } - return components -} -