add separated methods dedicated to the release deployment

This commit is contained in:
Roberto Cirillo 2022-10-11 10:09:24 +02:00
parent 3a1daa7401
commit 6f9a92a330
1 changed files with 26 additions and 30 deletions

54
Jenkinsfile vendored
View File

@ -230,16 +230,11 @@ pipeline {
def releaseList = []
jsonConfig.gCube_release.Components.each { group_name, component_list ->
if("${group_name}" == "${DEPLOY_CATEGORY}"){
// serviceName=component_list?.collect { "${it.name}" }
// serviceVersion=component_list?.collect { "${it.version}" }
println("component list of ${group_name} category is: ${component_list}")
// println("found ${serviceName} with version: ${serviceVersion}");
releaseList += component_list?.collect {return "$it.name,$it.version," }
releaseList += component_list?.collect {return "$it.name,$it.version" }
println("found ${releaseList}");
// releaseList += "${serviceName},${serviceVersion},"
}
}
deployJobs(releaseList);
deployReleaseJobs(releaseList);
}
@ -328,9 +323,9 @@ def deployRelease(String service, String version){
def checkupRelease(String service, String version){
sh("""
case "$version" in
**SNAPSHOT) echo "version contains SNAPSHOT" ; exit 1;;
**SNAPSHOT) echo "version contains SNAPSHOT. EXIT because this is a release build" ; exit 1;;
**latest) echo "version contains latest" ;;
* ) echo "version without SNAPSHOT. go ahead;;
* ) echo "version without SNAPSHOT. go;;
esac
""")
}
@ -396,32 +391,33 @@ def deployJobs(def serviceList){
for (def record : serviceList) {
println("Processing record: "+record)
service=record.split(",");
//check on target host
if(service[ 2 ]){
stage(service[0]){
println("Processing deploy: "+service[ 0 ])
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
checkup(service[0], service[ 1 ], service[2]);
deploy(service[0], service[ 1 ], service[2]);
}
stage(service[0]){
println("Processing deploy: "+service[ 0 ])
catchError(buildResult: 'UNSTABLE', stageResult: 'UNSTABLE') {
checkup(service[0], service[ 1 ], service[2]);
deploy(service[0], service[ 1 ], service[2]);
}
}else{
//this is a release build
stage(service[0]){
println("Processing RELEASE deploy: "+service[ 0 ])
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
checkupRelease(service[0], service[ 1 ], service[2]);
deployRelease(service[0], service[ 1 ], service[2]);
}
}
}
}
}
def deployReleaseJobs(def serviceList){
for (def record : serviceList) {
println("Processing record: "+record)
service=record.split(",");
stage(service[0]){
println("Processing RELEASE deploy: "+service[ 0 ])
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
checkupRelease(service[0], service[ 1 ]);
deployRelease(service[0], service[ 1 ]);
}
}
}
}
def parseBuildComponents( def text){
def components = []
"${text}".splitEachLine(',') { columns ->