Env var returning null in path Env var returning null in path jenkins jenkins

Env var returning null in path


In the pipeline groovy script simply use env.CERT_PATH = /home/ubuntu/certs/developer.cert.co.uk.pem


Though I cannot explain why i was getting null in my path, using the withEnv block around the relevant piece of my pipeline was what i ended up doing.

I normally do this but thought i could set the ENV var globally and be able to read from that without the need to so this, but seems to not be the case

withEnv(["CA_PATH=/home/ubuntu/certs/ca.pem", "CERT_PATH=/home/ubuntu/certs/developer.cert.co.uk.pem"]) { try {   sh '''#!/bin/bash -l         run tests      '''     TESTS = 'success' } catch (Exception err) {     TESTS = "failure" } }