Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • The Use secret text(s) or file(s) under BuildEnvironment -> Bindings is the right way to introduce secrets to a Jenkins Build. You should be able to access these secrets via environmental vars in your Jenkins script. Were you unable to access these environmental vars? Commented May 17, 2019 at 17:34
  • @datUser Yes, this is how I attempted to do this. I updated my question to hopefully clarify that. But I've ether failed at retrieving environment variables in the active choice parameter groovy script (see updates) or it is not available to these parameter plugins. Please note I have tried this with multiple parameter plugins. If you know how to do this, that would be perfect. Commented May 17, 2019 at 19:02
  • I think you are close, can you try println build.getBuildVariables().get('GITHUB_USER')? Commented May 17, 2019 at 20:40
  • For troubleshooting purposes I don't think that println helps for groovy scripts in active choice parameters. It will and does work in the build step. Though when I put def test = build.getBuildVariables().get("GITHUB_USER"); return test in the active parameter groovy script, it comes back blank. I also tried def test = build.getBuildVariables() to see if I could get it to return the entire list of environment variables, also returns blank. Is build a built in variable? Do I need to define it or import it first? Commented May 20, 2019 at 16:32