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 {
sh '''
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
if [ "${TRIGGER_JOB}" != 'gCubeBuilder' ]
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
'''
// 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') {
@ -195,14 +197,19 @@ pipeline {
}
}
steps {
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}");
}
}
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}");
}
}
}
}
}
}
stage('Deploy from gCubeRelease ') {
@ -210,6 +217,8 @@ pipeline {
anyOf{
triggeredBy 'BuildUpstreamCause'
triggeredBy 'UpstreamCause'
//added just for testing . To Remove.
triggeredBy 'UserIdCause'
}
// we should improve this conditional check
equals(actual: "${params.TRIGGER_JOB}", expected: 'gCubeBuilder')