Nikhil K R
Nikhil K R

Reputation: 707

Accessing Jenkins custom Build Parameter using Groovy Script

I have a Jenkins build job where I am passing few parameters while triggering the job. I need to use some of those parameters in a Groovy script. How to do that?

My Parameter is BUG_ID and its value is 2010

I am accessing as shown below

print ('BUILD_NO is '+System.getenv('BUG_ID'))
print ('BUILD_NO is ${BUG_ID}')
print ('BUILD_NO is ${env.BUG_ID}')

All returning null

Upvotes: 1

Views: 2813

Answers (1)

Thami Bouchnafa
Thami Bouchnafa

Reputation: 2167

Use double quotes:

print ("BUILD_NO is ${BUG_ID}")

Upvotes: 1

Related Questions