I upgraded Jenkins today from 1.618 to 2.3. This included installing a whole bunch of plugins that it recommended (Mostly Pipeline plugins and their dependencies).
Since the upgrade, I get a new error (or, at least, a new unwanted behavior) any time a job kicks off another job. Any values passed to the child as "Predefined parameters" are ignored unless the child job already has those keys defined.
Let me illustrate: Let's say that I have a parent
job and a child
job.
Parent
launches child
through a "Trigger parameterized build on other projects" Post-build Action. In the definition of that Post-build Action, under the "Predefined parameters", I have FOO=BAR
defined.
In Jenkins 1.618, when child
was triggered this way, it would have FOO
set as a parameter, with a value of BAR
.
But in 2.3, FOO
is not set on that build of child
.
If I modify child
so that FOO
is always a parameter of that job, it will then pick up the FOO=BAR
set from parent
. This is an unacceptable work-around because we pass dozens of parameters this way, and defining them on both ends is too fragile and violates the "don't repeat yourself" principle.
I get the same results whether I'm triggering the child job through through the "Trigger parameterized build on other projects" Post-build Action or through a MultiJob Phase of a MultiJob project.
Is this an intended change? Was it broken before, and we were just using it incorrectly? Or is this a bug?
Using build parameters, we can pass any data we want: git branch name, secret credentials, hostnames and ports, and so on. Any Jenkins job or pipeline can be parameterized. All we need to do is check the box on the General settings tab, “This project is parameterized”: Then we click the Add Parameter button.
This plugin lets you trigger new builds when your build has completed, with various ways of specifying parameters for the new build. These new builds appear as "Subprojects" in the Jenkins UI when you are looking at a project that triggers them.
There are some solutions
java -Dhudson.model.ParametersAction.keepUndefinedParameters=true -jar jenkins.war
import jenkins.model.*;
System.setProperty("hudson.model.ParametersAction.keepUndefinedParameters", "true")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With