Getting No branches to run in Jenins logs for my scripted pipeline

Currently I using Jenkins version [Jenkins 2.387.2].

I have one scrpted pipeline which is working fine in us environment but getting below ouput in eu environment

Logs

Running on test-env-start-stop-9-q50t7-xd26t-0dfbm in /home/jenkins/agent/workspace/test_env_start_stop
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Update deployment)
[Pipeline] container
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] parallel
No branches to run
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
Finished: SUCCESS

envstartstop.jenkinsfile

@Library('orbs')
import ai.alto_platform.ServiceSelect

orb = new ServiceSelect()

def generateParametersList() {
  def parametersList = [
    choice(choices: orb.getDeploymentsList(env.ENVIRONMENT), description: 'Where to deploy to', name: 'DEPLOYMENT'),
    choice(choices: ['---', 'start', 'stop'], description: 'Start or stop deployment', name: 'TYPE'),
    string(defaultValue: '', description: 'How many pods do you want', name: 'SERVICES_REPLICAS', trim: true),
  ]

  return parametersList
}

def checkAction(isDynamic, replicas, baseReplicas) {
  if (isDynamic) { return true }
  if (!isDynamic && replicas < baseReplicas ) { return false }
  return true
}

properties([
  parameters(generateParametersList()),
  pipelineTriggers([
    parameterizedCron('''
        H 17 * * * %TYPE=stop;
    ''')
  ])
])

podTemplate(yaml: """
apiVersion: v1
kind: Pod
spec:
  containers:
  - name: go-apps
    image: 412645720149.dkr.ecr.us-east-1.amazonaws.com/alto/go-applications:latest
    command: ['cat']
    env:
    - name: AWS_DEFAULT_REGION
      value: "${env.AWS_REGION}"
    tty: true
  serviceAccountName: jenkins-sa
"""
  ) {

  node(POD_LABEL) {
    stage('Update deployment') {
      container('go-apps') {
        script {
          def deployments = orb.getStartStopDeployments(env.ENVIRONMENT, env.AWS_REGION, env.DEPLOYMENT)

          def job = [:]

          if (TYPE == "start" || TYPE == "stop") {
            deployments.each {
              String DEPLOYMENT_NAME = it.key
              boolean IS_DYNAMIC = it.value["stop"]
              int BASE_REPLICAS = it.value["replicas"]
              int REPLICAS_COUNT = it.value["replicas"]

              if ((env.DEPLOYMENT && env.DEPLOYMENT != "---") && env.SERVICES_REPLICAS ) {
                REPLICAS_COUNT = Integer.parseInt(env.SERVICES_REPLICAS);
              }

              if (TYPE == "stop") {
                REPLICAS_COUNT = 0
              }

              if (checkAction(IS_DYNAMIC, REPLICAS_COUNT, BASE_REPLICAS)) {
                job["${DEPLOYMENT_NAME}"] = {
                  stage(DEPLOYMENT_NAME) {
                    sh """
                      export CONFIG=/tmp/config.yml
                      export NAMESPACE=${DEPLOYMENT_NAME}
                      export REPLICAS=${REPLICAS_COUNT}

                      gomplate --left-delim '<<' --right-delim '>>' -f /app/gomplate-templates/config.tmpl -o \${CONFIG}
                      environment-start-stop
                    """
                  }
                }
              }
            }
          } else {
            println "Nothing to do"
          }
        
          parallel job
        }
      }
    }
  }
}

ServiceSelect.groovy

package ai.alto_platform

public class ServiceSelect  {
  def serviceList = [
    qa: [
      "---": [repo: "---", image: "---", has_db: false, chart_repo: "", valid_deployments: ["---"]],
      "graphql": [repo: "alto-portal", image: "alto/graphql", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "portal": [repo: "alto-portal", image: "alto/portal", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "gateway": [repo: "alto-ai", image: "alto/gateway", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "service-management": [repo: "alto-ai", image: "alto/service-management", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "user-management": [repo: "alto-ai", image: "alto/user-management", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "semantic-data": [repo: "alto-ai", image: "alto/semantic-data", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "ar-model-data": [repo: "alto-ai", image: "alto/ar-model-data", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "semantic-index": [repo: "semantic-index", image: "alto/semantic-index", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "semantic-search": [repo: "semantic-search", image: "alto/semantic-search", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "auth": [repo: "alto-keycloak", image: "alto/keycloak", has_db: false, chart_repo: "codecentric", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "intelligent-search": [repo: "intelligent-search", image: "alto/intelligent-search", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "audit-log": [repo: "alto-ai", image: "alto/audit-log", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "search-manager": [repo: "alto-ai", image: "alto/search-manager", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "image-recognition": [repo: "image-recognition", image: "alto/image-recognition", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
      "image-recognition-worker": [repo: "image-recognition", image: "alto/image-recognition", has_db: false, chart_repo: "alto_private", valid_deployments: ["qa-1", "qa-2", "qa-3", "demo", "e2e"]],
    ],
    prod: [
      "---": [repo: "---", image: "---", has_db: false, chart_repo: "", valid_deployments: ["---"]],
      "graphql": [repo: "alto-portal", image: "alto/graphql", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "portal": [repo: "alto-portal", image: "alto/portal", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "gateway": [repo: "alto-ai", image: "alto/gateway", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "service-management": [repo: "alto-ai", image: "alto/service-management", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "user-management": [repo: "alto-ai", image: "alto/user-management", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "semantic-data": [repo: "alto-ai", image: "alto/semantic-data", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "ar-model-data": [repo: "alto-ai", image: "alto/ar-model-data", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "semantic-index": [repo: "semantic-index", image: "alto/semantic-index", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "semantic-search": [repo: "semantic-search", image: "alto/semantic-search", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "auth": [repo: "alto-keycloak", image: "alto/keycloak", has_db: false, chart_repo: "codecentric", valid_deployments: ["prod"]],
      "intelligent-search": [repo: "intelligent-search", image: "alto/intelligent-search", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "audit-log": [repo: "alto-ai", image: "alto/audit-log", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "search-manager": [repo: "alto-ai", image: "alto/search-manager", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "image-recognition": [repo: "image-recognition", image: "alto/image-recognition", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
      "image-recognition-worker": [repo: "image-recognition", image: "alto/image-recognition", has_db: false, chart_repo: "alto_private", valid_deployments: ["prod"]],
    ],
  ]
  
  def apiTests = [
    qa: [
      "us-east-1": [ testCase: [ "qa-1", "qa-2", "qa-3", "demo", "e2e" ], baseDomain: "qa.ai.carear.app", defaultTestDeployment: "demo",],
      "ca-central-1": [ testCase: [ "ca" ], baseDomain: "ca.qa.ai.carear.app", defaultTestDeployment: "demo",],
      "eu-central-1": [ testCase: [ "eu" ], baseDomain: "eu.qa.ai.carear.app", defaultTestDeployment: "demo",],
    ],
    prod: [
      "us-east-1": [ testCase: [ "prod" ], baseDomain: "ai.carear.app", defaultTestDeployment: "prod",],
    ],
  ]

  def databricksInstance = [
    qa: [
      "us-east-1": "dbc-b7cca391-cb19.cloud.databricks.com",
      "ca-central-1": "dbc-161ede5b-db60.cloud.databricks.com",
      "eu-central-1": "dbc-789a765f-e5a1.cloud.databricks.com",
    ],
    prod: [
      "us-east-1": "dbc-9f2c4bee-e531.cloud.databricks.com",
      "ca-central-1": "dbc-373eb745-84d7.cloud.databricks.com",
      "eu-central-1": "dbc-1df5c58d-e6ed.cloud.databricks.com",
    ],
  ]

  def envStartStop = [
    qa: [
      "us-east-1": [ 
        "qa-1": [ stop: false, replicas: 1 ],
        "qa-2": [ stop: true, replicas: 1 ],
        "qa-3": [ stop: true, replicas: 1 ],
        "demo": [ stop: false, replicas: 2 ],
        "e2e": [ stop: true, replicas: 1 ],
      ],
      "ca-central-1": [ 
        "demo": [ stop: true, replicas: 2 ], 
      ],
      "eu-central-1": [ 
        "demo": [ stop: false, replicas: 2 ],
      ],
    ]
  ]

  def getServicesList(environment) {
    def services = []
    serviceList[environment].each{
      key, value -> services.add(key)
    }
    
    return services
  }

  def getDeploymentsList(environment) {
    def deployments = []
    serviceList[environment].each{
      key, value -> deployments.addAll(value.valid_deployments)
    }
    
    return deployments.unique()
  }

  def getServiceRepository(environment, service) {
    return serviceList[environment][service]["repo"]
  }
  
  def getServiceImage(environment, service) {
    return serviceList[environment][service]["image"]
  }
  
  def getChartRepo(environment, service) {
    return serviceList[environment][service]["chart_repo"]
  }

  def getImageRepo(environment, service) {
    return serviceList[environment][service]["image"]
  }

  def getTestCase(environment, region) {
    return apiTests[environment][region]["testCase"].unique()
  }

  def getBaseDomain(environment, region) {
    return apiTests[environment][region]["baseDomain"]
  }

  def getDefaultTestDeployment(environment, region) {
    return apiTests[environment][region]["defaultTestDeployment"]
  }

  def getDatabricksInstance(environment, region) {
    return databricksInstance[environment][region]
  }

  def getStartStopDeployments(environment, region, deployment = null) {
    if (deployment == "---") {
      return envStartStop[environment][region]
    } else if (deployment){
      return [(deployment): envStartStop[environment][region][deployment]]
    }
    else {
      return envStartStop[environment][region]
    }
  }

Can you suggest I want to make my deployment replica to 0 while stop and make to one or more while start

Hi, I just made a similar test based on your script, and the result looks good. Could you provide your full environment variables and try to print the job before parallel?

These are my test scripts:

Jenkinsfile

podTemplate(yaml:'''
apiVersion: v1
kind: Pod
# metadata:
#   labels:
#     usage: compile
spec:
  containers:
    - name: test
      image: debian:9
      command: ["sleep","1800"]
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
          - matchExpressions:
            - key: sname
              operator: In
              values:
                - k8s-4
  tollerations:
    - key: usage
      operator: Equal
      value: build

'''){
    node(POD_LABEL){
        container("test"){
            builds = [:]
        
        
        def items = [
            "first" : ["v1":"first-1","v2":"first-2"],
            "second" : ["v1":"second-1","v2":"second-2"]
            ]
        
        
        items.each{
            String ITNAME = it.key
            String VALUE1 = it.value["v1"]
            String VALUE2 = it.value["v2"]

            builds[ITNAME] = {
                stage(ITNAME){
                    sh " echo 'Thsi is ${ITNAME} ${VALUE1} ${VALUE2}'"
                }
            }
        }
        
        println(builds)
        builds.failFast = false
        parallel builds
        }
    }
}

Output

17:32:02  Created Pod: kubernetes default/test-613-tm8qx-hxkpm-b9ncz
17:32:06  Agent test-613-tm8qx-hxkpm-b9ncz is provisioned from template test_613-tm8qx-hxkpm
17:32:06  ---
17:32:06  apiVersion: "v1"
17:32:06  kind: "Pod"
17:32:06  metadata:
17:32:06    annotations:
17:32:06      buildUrl: "http://10.101.35.236:8080/job/test/613/"
17:32:06      runUrl: "job/test/613/"
17:32:06    labels:
17:32:06      jenkins: "slave"
17:32:06      jenkins/label-digest: "e9c2309b7934c76724f99438cb70ea6efd4c4826"
17:32:06      jenkins/label: "test_613-tm8qx"
17:32:06    name: "test-613-tm8qx-hxkpm-b9ncz"
17:32:06  spec:
17:32:06    affinity:
17:32:06      nodeAffinity:
17:32:06        requiredDuringSchedulingIgnoredDuringExecution:
17:32:06          nodeSelectorTerms:
17:32:06          - matchExpressions:
17:32:06            - key: "sname"
17:32:06              operator: "In"
17:32:06              values:
17:32:06              - "k8s-4"
17:32:06    containers:
17:32:06    - command:
17:32:06      - "sleep"
17:32:06      - "1800"
17:32:06      image: "debian:9"
17:32:06      name: "test"
17:32:06      volumeMounts:
17:32:06      - mountPath: "/home/jenkins/agent"
17:32:06        name: "workspace-volume"
17:32:06        readOnly: false
17:32:06    - env:
17:32:06      - name: "JENKINS_SECRET"
17:32:06        value: "********"
17:32:06      - name: "JENKINS_AGENT_NAME"
17:32:06        value: "test-613-tm8qx-hxkpm-b9ncz"
17:32:06      - name: "JENKINS_NAME"
17:32:06        value: "test-613-tm8qx-hxkpm-b9ncz"
17:32:06      - name: "JENKINS_AGENT_WORKDIR"
17:32:06        value: "/home/jenkins/agent"
17:32:06      - name: "JENKINS_URL"
17:32:06        value: "http://10.101.35.236:8080/"
17:32:06      image: "jenkins/inbound-agent:3198.v03a_401881f3e-1"
17:32:06      name: "jnlp"
17:32:06      resources:
17:32:06        requests:
17:32:06          memory: "256Mi"
17:32:06          cpu: "100m"
17:32:06      volumeMounts:
17:32:06      - mountPath: "/home/jenkins/agent"
17:32:06        name: "workspace-volume"
17:32:06        readOnly: false
17:32:06    restartPolicy: "Never"
17:32:06    volumes:
17:32:06    - emptyDir:
17:32:06        medium: ""
17:32:06      name: "workspace-volume"
17:32:06    tollerations:
17:32:06    - key: "usage"
17:32:06      operator: "Equal"
17:32:06      value: "build"
17:32:06  
17:32:06  Running on test-613-tm8qx-hxkpm-b9ncz in /home/jenkins/agent/workspace/test
17:32:06  [Pipeline] {
17:32:06  [Pipeline] container
17:32:06  [Pipeline] {
17:32:06  [Pipeline] echo
17:32:06  {first=org.jenkinsci.plugins.workflow.cps.CpsClosure2@4f9d5eb4, second=org.jenkinsci.plugins.workflow.cps.CpsClosure2@52e1ee6f}
17:32:06  [Pipeline] parallel
17:32:06  [Pipeline] { (Branch: first)
17:32:06  [Pipeline] { (Branch: second)
17:32:06  [Pipeline] stage
17:32:06  [Pipeline] { (first)
17:32:06  [Pipeline] stage
17:32:06  [Pipeline] { (second)
17:32:06  [Pipeline] sh
17:32:07  [Pipeline] sh
17:32:07  + echo Thsi is first first-1 first-2
17:32:07  Thsi is first first-1 first-2
17:32:07  [Pipeline] }
17:32:07  [Pipeline] // stage
17:32:07  [Pipeline] }
17:32:08  + echo Thsi is second second-1 second-2
17:32:08  Thsi is second second-1 second-2
17:32:08  [Pipeline] }
17:32:08  [Pipeline] // stage
17:32:08  [Pipeline] }
17:32:08  [Pipeline] // parallel
17:32:08  [Pipeline] }
17:32:08  [Pipeline] // container
17:32:08  [Pipeline] }
17:32:08  [Pipeline] // node
17:32:08  [Pipeline] }
17:32:08  [Pipeline] // podTemplate
17:32:08  [Pipeline] End of Pipeline
17:32:08  Finished: SUCCESS