title: How to pass through params to Jenkins job?
body: <p>Job A triggers 2 parallel parametrized jobs B.</p>
  
  <p><strong>Job A:</strong></p>
  
  <pre><code>stage('Build and Deploy') {
      branch = "${BRANCH}"
  
      def builds = [:]
      builds["A"] = {
          build job: 'job-A',parameters: [
              string(name: 'module', value: "A"),
              string(name: 'BRANCH', value: ${BRANCH}),
              string(name: 'AUTO_DEPLOY', value: 'true') ],  quietPeriod: 2
          }
      builds["B"] = {
          build job: 'job-B', parameters: [
              string(name: 'module', value: "A"),
              string(name: 'BRANCH', value: ${BRANCH}),
              string(name: 'AUTO_DEPLOY', value: 'true')], quietPeriod: 2
      }
      parallel builds
  
      build job: "deploy-job-A", parameters: [string(name: 'AUTO_DEPLOY', value: "true")], wait: false
      build job: "deploy-job-B", parameters: [string(name: 'AUTO_DEPLOY', value: "true")], wait: false
  
  }
  </code></pre>
  
  <p>It has a choice parameter <code>BRANCH</code> that has names of branches that need to be passed to job B. Another choice parameter is <code>AUTO_DEPLOY</code> that is passed to job B and job B must pass it down the chain because it is needed in job C.</p>
  
  <p><strong>Job B</strong></p>
  
  <pre><code>node {
      stage("Build job-${module} image") {
          branch = "${env.BRANCH}"
          checkout scm
          buildVersion= readFile('job.version').trim() + ".${BUILD_NUMBER}"
          // stuff
          build job: "deploy-${JOB_NAME}", parameters: [
                  string(name: 'buildVersion', value: buildVersion),
                  string(name: 'AUTO_DEPLOY', value: ${env.AUTO_DEPLOY})], wait: false
      }
  }
  </code></pre>
  
  <p><strong>Job C:</strong></p>
  
  <pre><code>script {
      def deployVersion = "${image}".substring("${image}".lastIndexOf(':') + 1)
      currentBuild.description = "${deployVersion}"
  }
  
  stage('Checkout') {
      node {
          checkout scm
      }
  }
  stage('Deploy prelive') {
      try {
          milestone 1
          if (${env.AUTO_DEPLOY} != 'true') {
              input message: "Deploy ${image} to prelive?"
          }
          milestone 2
          // stuff
  }
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>job A throws </p>
  
  <pre><code>java.lang.NoSuchMethodError: No such DSL method '$' found among steps
  </code></pre>
  
  <p>most likely it cannot resolve param <code>string(name: 'BRANCH', value: ${BRANCH})</code></p>