简体   繁体   中英

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}"

在此处输入图片说明

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

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.

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

version = env.version

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM