Jenkins pipeline pass all but manipulated parameters to downstream

Viewed 1324
1 Answers

after some playing around I got it working like this (although I guess it's not very sophisticated):

newparams=[ string(name: 'PARA1', value: '17'),
            string(name: 'PARA2', value: 'true'),  ]
def myparams = currentBuild.rawBuild.getAction(ParametersAction).getParameters()
myparams.each{
    if (it.name!='PARA1')   // don't copy PARA1 from myparams
        newparams+=it       // add all others
    }

buildresult= build job: jobname, propagate: false, parameters: newparams

...so it doesn't simply forward all parameters from getParameters() but copies them to "newparams" one by one. That's where I have the possibility to do some manipulations to the list.
I use it for string parameters only - didn't test with others...

Related