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

Declarative Pipeline Environment ignored

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • kubernetes-plugin
    • None

    Description

      The environment declarative no longer works in pipeline. 

       

      pipeline {
        agent {
          kubernetes {
              label 'maven-pod'
              containerTemplate {
              name 'maven-container'
              image 'maven'
              workingDir  '/home/jenkins'
              ttyEnabled true
              command 'cat'
              }
          }
        }
        environment {
          test = 'Hello World!'
        }
        stages {
          stage('print') {
            steps {
              //will not print
              sh 'echo ${test}'
               container('maven-container'){
                   //will also not print
                    sh 'echo ${test}'
                 }
              }
            }
          }
        }    
      
      
      

      It appears to be due to environment variables for the container being set prior to container execution.

      Attachments

        Issue Links

          Activity

            People

              csanchez Carlos Sanchez
              seakip18 Matthew Ludlum
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: