It's println "${env."${env.BUILD_ENV}_deployed"}"
On Monday, February 22, 2021 at 9:25:50 PM UTC-5 zil...@gmail.com wrote: > In my Jenkins system configuration page, I have 3 variables defined, > namely, sandbox_deployed, staging_deployed, and production_deployed. In > my pipeline, I want to access one of these variables, based on a pipeline > property, BUILD_ENV, defined in the job's configuration page. IOW, in my > job's configuration page I have > BUILD_ENV=sandbox > > How can I write pipeline code that does > println "$env.${env.BUILD_ENV}_deployed" > > If I write it like in the above println, I get > org.jenkinsci.plugins.wo...@336841dd.sandbox_deployed > > But I really want this > println "env.sandbox_deployed" > > which prints out the correct value of the sandbox_deployed variable. > What's the correct syntax? > > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d4057381-3305-49c3-b198-521073ba3c50n%40googlegroups.com.