Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-52971

Parameters are not available in a container block

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • kubernetes-plugin
    • None

       

      parameters {
         string(name: 'PERSON', defaultValue: 'Mr Jenkins', description: 'Who should I say hello to?')
      }
      def label = "mypod-${UUID.randomUUID().toString()}"podTemplate(label: label, containers: [
         containerTemplate(name: 'maven', image: 'maven:3.3.9-jdk-8-alpine', ttyEnabled: true, command: 'cat'),
      ]) {
          node(label) {
              stage('Get a Maven project') {
                  git 'https://github.com/jenkinsci/kubernetes-plugin.git'
                  container('maven') {
                      stage('Build a Maven project') {
                           echo "Hello ${params.PERSON}"
                      }
                  }
              }
          }
        }

       
      output

            Unassigned Unassigned
            runzexia runze xia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: