0

I have x2 declarative pipeline Jobs, both with many many params. How can I take the params provided to the parent, and add to them, to pass to the child job?

I currently define them all individually, but this is prone to mistakes as there's a lot of them.

I also have figured out it's possible to obtain a list of params and pass them to the child job:

script{
    def myparams = currentBuild.rawBuild.getAction(ParametersAction).getParameters()
    build( job: 'childJobName', parameters: myparams)
}

What I haven't figured out is how to add to this list as it's unmodifiable. I'd need to make a copy and add to that, but I've not had any success doing this.

Mark W
  • 5,824
  • 15
  • 59
  • 97
  • lets say parent job has 20 params and child job has 22, of which 20 are the same as the parent. So I need to add two params to the list. – Mark W Dec 11 '18 at 10:58

1 Answers1

1

hi you can use paramsArray = myparams.collect() which gives you the Array which you can modify later i.e. add or remove the values in it

Amit Nanaware
  • 3,203
  • 1
  • 6
  • 19