replace gCubeBuilder string with RELEASE_JOB var

This commit is contained in:
Roberto Cirillo 2022-10-11 10:47:22 +02:00
parent c9dee5146a
commit 928bbfa138
1 changed files with 18 additions and 48 deletions

66
Jenkinsfile vendored
View File

@ -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
}