0

I'm "[preparing] an environment for the run" like so, in my pipeline project:

Prepared Environment

Yet, whenever I try to follow this example in my Jenkinsfile (which looks like this):

node {
    currentBuild.result = "SUCCESS"
    try {   
        stage("Checkout") {
            checkout scm
        }

        stage("Setup") {
            def API_BASE_URL = env.API_BASE_URL
            print "API_BASE_URL : ${API_BASE_URL}"
        }
    } catch (err) {
        currentBuild.result = "FAILURE"
        print "Build failed"
        print err
        throw err
    }
}

I end up with this, in my logs:

Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Setup)
[Pipeline] echo
API_BASE_URL : null
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

Any ideas?

Community
  • 1
  • 1
drewwyatt
  • 5,989
  • 15
  • 60
  • 106
  • When I am running the same setup, it is working for me and displaying the required value. Is there anything else you are doing in your job? – Manish Joshi Jan 27 '17 at 03:43
  • @ManishJoshi nope. this is it. I don't have access to see what version of EnvInject we are using though. I assume it's probably that. – drewwyatt Jan 30 '17 at 15:40

0 Answers0