Mateusz Sobczak
Mateusz Sobczak

Reputation: 1623

Jenkins pass variable into groovy script

Hi I need to pass a variable from select into the groovy script and I haven't a clue how to do it in variable bindings, anyone has an idea how to do it?

I tried with:

version=version

version=$version

version=${version}

version="${version}"

enter image description here

Upvotes: 0

Views: 604

Answers (2)

Jiho
Jiho

Reputation: 348

Where is the 'version' variable came from?
If you are trying to use Environment variables, then you should try like,

version = env.version

Upvotes: 1

mndrye
mndrye

Reputation: 529

If you are going to use ${ ... } Notation you should enclose it double quotes, i.e.:

versionVar = "${version}"

The other think that keeps bothering me is that you are using the same variable name. I haven't tried but I think that using the same name you could are trying to use the same variable.

Upvotes: 1

Related Questions