enable check on special yaml category distribution. restored

IS_SCHEDULED_TEST var
This commit is contained in:
Roberto Cirillo 2022-10-12 10:46:02 +02:00
parent de1e8cfd01
commit 71d9b17425
1 changed files with 15 additions and 12 deletions

27
Jenkinsfile vendored
View File

@ -120,7 +120,7 @@ pipeline {
anyOf{
allOf{
triggeredBy 'TimerTrigger'
environment name: 'IS_SCHEDULED', value: 'True'
environment name: 'IS_SCHEDULED_TEST', value: 'True'
}
}
}
@ -140,7 +140,7 @@ pipeline {
anyOf{
allOf{
triggeredBy 'TimerTrigger'
environment name: 'IS_SCHEDULED', value: 'False'
environment name: 'IS_SCHEDULED_TEST', value: 'False'
}
}
@ -152,7 +152,7 @@ pipeline {
}
stage('New pending deploy ') {
when{
environment name: 'IS_SCHEDULED', value: 'True'
environment name: 'IS_SCHEDULED_TEST', value: 'True'
anyOf{
triggeredBy 'BuildUpstreamCause'
triggeredBy 'UpstreamCause'
@ -180,7 +180,7 @@ pipeline {
}
stage('Deploy from job ') {
when{
environment name: 'IS_SCHEDULED', value: 'False';
environment name: 'IS_SCHEDULED_TEST', value: 'False';
expression {
env.TRIGGER_CD.toBoolean()
}
@ -220,16 +220,19 @@ pipeline {
if("${DEPLOY_CATEGORY}"){
println("Going to deploy the Release components")
def releaseList = []
def smartgears
def categories="${DEPLOY_CATEGORY}".split(',')
jsonConfig.gCube_release.Components.each { group_name, component_list ->
for ( def category ; categories){
if("${group_name}" == "${DEPLOY_CATEGORY}"){
for ( def category : categories){
if("${group_name}" == "$category"){
smartgears = (category == 'Distribution') ? $it.version : ''
def location = (user.city == null) ? user.state : user.city
releaseList += component_list?.collect {return "$it.name,$it.version" }
println("found ${releaseList}");
}
}
}
deployReleaseJobs(releaseList);
deployReleaseJobs(releaseList, smartgears);
}
}
}
@ -237,7 +240,7 @@ pipeline {
stage('Deploy manually ') {
when{
allOf{
environment name: 'IS_SCHEDULED', value: 'False';
environment name: 'IS_SCHEDULED_TEST', value: 'False';
triggeredBy 'UserIdCause'
}
}
@ -301,10 +304,10 @@ def checkup(String service, String version, String host){
}
//launch ansible deploy
def deployRelease(String service, String version){
def deployRelease(String service, String version, String 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 ;", returnStdout: true);
def statusCode = sh( script: "cd $ANSIBLE_ROOT_FOLDER;git pull;./deployPreprodService.sh $service $version $smartgears ;", returnStdout: true);
sh("""
echo " last exit code \$?";
""")
@ -357,7 +360,7 @@ def deployJobs(def serviceList){
}
//Deploy only release components. All the component are passed as: componentName,componentVersion
def deployReleaseJobs(def serviceList){
def deployReleaseJobs(def serviceList, def smartgears){
for (def record : serviceList) {
println("Processing record: "+record)
service=record.split(",");
@ -365,7 +368,7 @@ def deployReleaseJobs(def serviceList){
println("Processing RELEASE deploy: service "+service[ 0 ]+" with version "+service[ 1 ])
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
checkupRelease(service[0], service[ 1 ]);
deployRelease(service[0], service[ 1 ]);
deployRelease(service[0], service[ 1 ], smartgears);
}
}
}