Asif Kamran Malick
Asif Kamran Malick

Reputation: 3171

Read Jenkins environment variable from an application

I have a Jenkins job where I execute a groovy script. From within that groovy script I make a POST request to another application. My Jenkins server and application are on different machines. I need to get access to the Jenkins environment variable from within the application's code. Is this at all possible?

I have tried to retrieve the environment variable by using the System.getenv("ENVIRONMENT-VARIABLE-NAME") method, but the result returned is null.

Upvotes: 0

Views: 232

Answers (1)

Bhanuchander Udhayakumar
Bhanuchander Udhayakumar

Reputation: 1621

Updated:

I think, It can't be. If you are using POST, then you can send the variables as query/path params to your application.

You can get ur env variable in your jenkins server like this:

${env.ENVIRONMENT_NAME}

Upvotes: 1

Related Questions