Skip to content

JENKINS-31843 - Merge build parameter values when "Build is parameterized"#34

Open
Evildethow wants to merge 6 commits intojenkinsci:masterfrom
Evildethow:JENKINS-31843
Open

JENKINS-31843 - Merge build parameter values when "Build is parameterized"#34
Evildethow wants to merge 6 commits intojenkinsci:masterfrom
Evildethow:JENKINS-31843

Conversation

@Evildethow
Copy link
Copy Markdown

  • Ensures no duplicates
  • Give precedence to values supplied from "Build is parameterized" (overrides).

NOTE: Currently on rebuild if parameters are supplied via "Build is parameterized" then any pre existing parameters are clobbered.

…ized".

Give precedence to values supplied from "Build is parameterized" (overrides)
@Evildethow
Copy link
Copy Markdown
Author

@reviewbybees

@oleg-nenashev
Copy link
Copy Markdown
Member

Needs several unit tests.
Please also avoid formatting changes, because they extend the review scope and may cause merge conflicts

@Evildethow
Copy link
Copy Markdown
Author

@oleg-nenashev

  • sry about the formatting. i missed that on review.
  • will add unit tests

regards

@ghost
Copy link
Copy Markdown

ghost commented Dec 2, 2015

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.

@Evildethow
Copy link
Copy Markdown
Author

@oleg-nenashev Added tests

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should check for null before accessing paramAction

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@amuniz
Copy link
Copy Markdown
Member

amuniz commented Dec 11, 2015

🐝

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

@varmenise
Copy link
Copy Markdown

🐜 IMHO the classes implemented to support the tests (IsCollectionContainingStringParameterValues, IsNotCollectionContainingStringParameterValues, StringParameterValueMatcher) are an overkill here and make it really difficult to follow the flow. You could just do all of that with a method which iterates on parameters without using the Matcher class. If you really want to stick with the approach, it should be a bit cleaned up (some methods/classes are unnecessary I would think)

@Evildethow
Copy link
Copy Markdown
Author

@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.

@varmenise
Copy link
Copy Markdown

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 🐝

@kwhetstone
Copy link
Copy Markdown

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. 🐝

@Evildethow
Copy link
Copy Markdown
Author

Well, I actually meant that those 3 classes (that could be reduced to 1) were an overkill

Sorry @varmenise I misread that. Blaming this on the early morning and weak coffee ;)

@varmenise
Copy link
Copy Markdown

@Evildethow no worries :)

@Evildethow
Copy link
Copy Markdown
Author

@hagzag @shemeersulaiman Could i get a maintainer to look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants