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

9
Jenkinsfile vendored
View File

@ -167,6 +167,7 @@ pipeline {
} }
steps { steps {
sh ''' sh '''
if [ "${TRIGGER_JOB}" != 'gCubeBuilder' ]
echo "Cron build enabled. New deploy of ${TRIGGER_JOB} - ${TRIGGER_VERSION} will be added to the pending deploy file" echo "Cron build enabled. New deploy of ${TRIGGER_JOB} - ${TRIGGER_VERSION} will be added to the pending deploy file"
touch $DEPLOY_FILE; touch $DEPLOY_FILE;
if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then if grep -q \"\${TRIGGER_JOB}\" \${DEPLOY_FILE}; then
@ -174,6 +175,7 @@ pipeline {
else else
echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE} echo "${TRIGGER_JOB},${TRIGGER_VERSION},${TRIGGER_HOST}" >> ${DEPLOY_FILE}
fi 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,6 +197,8 @@ pipeline {
} }
} }
steps { steps {
script{
if("${TRIGGER_JOB}" != 'gCubeBuilder'){
echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing" echo "Cron build disabled. New deploy of ${params.TRIGGER_JOB} - ${params.TRIGGER_VERSION} ongoing"
ansiColor("xterm") { ansiColor("xterm") {
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
@ -202,6 +206,9 @@ pipeline {
deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}"); deploy("${params.TRIGGER_JOB}", "${params.TRIGGER_VERSION}", "${params.TRIGGER_HOST}");
} }
} }
}
}
} }
} }
@ -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')