0

I'd like to iterate over the env vars in a Jenkins Pipeline script. So that I can use those that match a certain pattern (like "GERRIT_*") for starting a sub-job with them.

My first attempts where something like env.each{ println it } which failed.

So my only solution is going through the shell like envtext= "printenv".execute().text and then evaluating envtext.

But this seems quite clumsy so I'm wondering if there is a more "direct" solution...

StephenKing
  • 36,187
  • 11
  • 83
  • 112
Roman
  • 707
  • 8
  • 16

0 Answers0