JENKINS-31843 - Merge build parameter values when "Build is parameterized"#34
JENKINS-31843 - Merge build parameter values when "Build is parameterized"#34Evildethow wants to merge 6 commits intojenkinsci:masterfrom
Conversation
…ized". Give precedence to values supplied from "Build is parameterized" (overrides)
|
@reviewbybees |
|
Needs several unit tests. |
regards |
|
This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation. |
|
@oleg-nenashev Added tests |
There was a problem hiding this comment.
You should check for null before accessing paramAction
There was a problem hiding this comment.
@amuniz Added the null check to be safe but struggling to see how 'paramAction' would be null at this stage based on - https://github.com/jenkinsci/rebuild-plugin/blob/master/src/main/java/com/sonyericsson/rebuild/RebuildAction.java#L206
The lack of null checks in the existing code seems to echo this - https://github.com/jenkinsci/rebuild-plugin/blob/master/src/main/java/com/sonyericsson/rebuild/RebuildAction.java#L417
Either that or its just really fragile :)
cheers
There was a problem hiding this comment.
Probably you are right, the action will be always set and it's never null, but, in general, I think it's a good practice to check for null the return value of getAction, since it depends on someone adding that action before (and in some cases even in a separate plugin, which is clearly butterfly effect prone 😄 IMO)
|
🐝 |
There was a problem hiding this comment.
I would suggest to rename this test, I think there's something wrong with the sentence itself and it is not really clear what's the goal of the test, probably something like "newParametersShouldOverrideExistingPatametersIfHaveSameName" or something like that.
|
🐜 IMHO the classes implemented to support the tests ( |
|
@varmenise Cleaned up test names and refactored matchers into single matcher taking varargs. RE: "classes implemented to support tests are an overkill" - I would have to disagree when it comes to things like rules and matchers but as you mentioned this is possibly more personal preference / opinion than anything. |
|
Well, I actually meant that those 3 classes (that could be reduced to 1) were an overkill, but the current cleanup is good to me! so 🐝 |
|
I think it's better to err on the side of "too many tests" just because you never know. It looks good with all the changes. 🐝 |
Sorry @varmenise I misread that. Blaming this on the early morning and weak coffee ;) |
|
@Evildethow no worries :) |
|
@hagzag @shemeersulaiman Could i get a maintainer to look at this? |
NOTE: Currently on rebuild if parameters are supplied via "Build is parameterized" then any pre existing parameters are clobbered.