简体   繁体   中英

How do I access a variable from Bamboo in a Gradle script?

I am creating a deployment in Bamboo. I have some variables set up under the deployment plan. How can I access these from a Gradle script? There is an arguments input (that I guess I would use something like variable=${bamboo.variable} in there, but I cant work out how to get them to go through to the script (at the moment just doing something like prinln varible to get them out). How can I do this?

As far as I know, Bamboo exports all it's variable into the build environment. In that case, you can get any variable within the script as follows:

System.getenv('bamboo.variable')

Alternatively, you may pass it into the build as build script parameter, like so:

-Pvariable=${bamboo.variable}

and then you can get it within a script as a project property:

println variable

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