From ab2eb45cbd16998071dd61d4291bcd7b444d66d4 Mon Sep 17 00:00:00 2001 From: "roberto.cirillo" Date: Wed, 12 Oct 2022 11:33:43 +0200 Subject: [PATCH] fix call to deployRelease --- Jenkinsfile | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 88ac8a5..6583840 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -220,17 +220,17 @@ pipeline { if("${DEPLOY_CATEGORY}"){ println("Going to deploy the Release components") def releaseList = [] - String smartgears + boolean smartgears def categories="${DEPLOY_CATEGORY}".split(',') jsonConfig.gCube_release.Components.each { group_name, component_list -> for ( def category : categories){ if("${group_name}" == "$category"){ if (category == 'Distribution'){ - smartgears = component_list?.collect {return "$it.version"[ 0 ] } - }else{ - releaseList += component_list?.collect {return "$it.name,$it.version" } - println("found ${releaseList}"); - } + smartgears = true + continue + } + 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 -def deployRelease(String service, String version, String smartgears){ +def deployRelease(String service, String version, boolean smartgears){ def now = new Date(); 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); @@ -362,7 +362,7 @@ def deployJobs(def serviceList){ } //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) { println("Processing record: "+record) 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) catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { 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); } } }