add condition in order to avoid job stages when the job is gCubeBuilder

pipeline
This commit is contained in:
Roberto Cirillo 2022-10-10 17:10:42 +02:00
parent 65971dff31
commit 244797a151
1 changed files with 23 additions and 14 deletions

37
Jenkinsfile vendored
View File

@ -167,13 +167,15 @@ pipeline {
} }
steps { steps {
sh ''' sh '''
echo "Cron build enabled. New deploy of ${TRIGGER_JOB} - ${TRIGGER_VERSION} will be added to the pending deploy file" if [ "${TRIGGER_JOB}" != 'gCubeBuilder' ]
touch $DEPLOY_FILE; echo "Cron build enabled. New deploy of ${TRIGGER_JOB} - ${TRIGGER_VERSION} will be added to the pending deploy file"
if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then touch $DEPLOY_FILE;
echo "component ${TRIGGER_JOB} already added. Nothing to add." if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then
else echo "component ${TRIGGER_JOB} already added. Nothing to add."
echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE} else
fi echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE}
fi
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 // 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') { catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
@ -195,14 +197,19 @@ pipeline {
} }
} }
steps { steps {
echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" script{
ansiColor("xterm") { if("${TRIGGER_JOB}" != 'gCubeBuilder'){
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing"
checkup("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); ansiColor("xterm") {
deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); 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}");
}
}
}
}
} }
} }
stage('Deploy from gCubeRelease ') { stage('Deploy from gCubeRelease ') {
@ -210,6 +217,8 @@ pipeline {
anyOf{ anyOf{
triggeredBy 'BuildUpstreamCause' triggeredBy 'BuildUpstreamCause'
triggeredBy 'UpstreamCause' triggeredBy 'UpstreamCause'
//added just for testing . To Remove.
triggeredBy 'UserIdCause'
} }
// we should improve this conditional check // we should improve this conditional check
equals(actual: "${params.TRIGGER_JOB}", expected: 'gCubeBuilder') equals(actual: "${params.TRIGGER_JOB}", expected: 'gCubeBuilder')