fix call to deployRelease

This commit is contained in:
Roberto Cirillo 2022-10-12 11:33:43 +02:00
parent 3813bda08d
commit ab2eb45cbd
1 changed files with 12 additions and 9 deletions

21
Jenkinsfile vendored
View File

@ -220,17 +220,17 @@ pipeline {
if("${DEPLOY_CATEGORY}"){ if("${DEPLOY_CATEGORY}"){
println("Going to deploy the Release components") println("Going to deploy the Release components")
def releaseList = [] def releaseList = []
String smartgears boolean smartgears
def categories="${DEPLOY_CATEGORY}".split(',') def categories="${DEPLOY_CATEGORY}".split(',')
jsonConfig.gCube_release.Components.each { group_name, component_list -> jsonConfig.gCube_release.Components.each { group_name, component_list ->
for ( def category : categories){ for ( def category : categories){
if("${group_name}" == "$category"){ if("${group_name}" == "$category"){
if (category == 'Distribution'){ if (category == 'Distribution'){
smartgears = component_list?.collect {return "$it.version"[ 0 ] } smartgears = true
}else{ continue
releaseList += component_list?.collect {return "$it.name,$it.version" } }
println("found ${releaseList}"); releaseList += component_list?.collect {return "$it.name,$it.version" }
} println("found ${releaseList}");
} }
} }
} }
@ -306,7 +306,7 @@ def checkup(String service, String version, String host){
} }
//launch ansible deploy //launch ansible deploy
def deployRelease(String service, String version, String smartgears){ def deployRelease(String service, String version, boolean smartgears){
def now = new Date(); def now = new Date();
println("Going to deploy the service "+service+" with version: "+version+" on preproduction "); println("Going to deploy the service "+service+" with version: "+version+" on preproduction ");
def statusCode = sh( script: "cd $ANSIBLE_ROOT_FOLDER;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true); def statusCode = sh( script: "cd $ANSIBLE_ROOT_FOLDER;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true);
@ -362,7 +362,7 @@ def deployJobs(def serviceList){
} }
//Deploy only release components. All the component are passed as: componentName,componentVersion //Deploy only release components. All the component are passed as: componentName,componentVersion
def deployReleaseJobs(def serviceList, String smartgears){ def deployReleaseJobs(def serviceList, boolean smartgears){
for (def record : serviceList) { for (def record : serviceList) {
println("Processing record: "+record) println("Processing record: "+record)
service=record.split(","); service=record.split(",");
@ -370,7 +370,10 @@ def deployReleaseJobs(def serviceList, String smartgears){
println("Processing RELEASE deploy: service "+service[ 0 ]+" with version "+service[ 1 ]+" and SG "+smartgears) println("Processing RELEASE deploy: service "+service[ 0 ]+" with version "+service[ 1 ]+" and SG "+smartgears)
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
checkupRelease(service[0], service[ 1 ]); checkupRelease(service[0], service[ 1 ]);
deployRelease(service[0], service[ 1 ], smartgears); if (smartgears)
deployRelease(service[0], service[ 1 ], smartgears);
else
deployRelease(service[0], service[ 1 ], null);
} }
} }
} }