Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Evildethow
Copy link

  • 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
Author

@reviewbybees

@oleg-nenashev
Copy link
Member

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

@Evildethow
Copy link
Author

@oleg-nenashev

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

regards

@ghost
Copy link

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
Author

@oleg-nenashev Added tests

public int compare(ParameterValue o1, ParameterValue o2) {
return o1.getName().compareTo(o2.getName());
}
}, Iterables.concat(values, paramAction.getParameters()));
Copy link
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
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
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
Member

amuniz commented Dec 11, 2015

🐝

@@ -393,6 +398,110 @@ public void testRebuildSupportedUnknownParameterValue() throws Exception {
page.asText().contains("This is a mark for test"));
}

public void testWhenProjectWithExistingParamAndOverridingParamWhenRebuild()
throws Exception {

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

🐜 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
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

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

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

@Evildethow no worries :)

@Evildethow
Copy link
Author

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

@Evildethow
Copy link
Author

User confirmed changes resolved issue using a snapshot version with these changes

@eis
Copy link

eis commented Mar 11, 2016

So, what's holding back merging this in?

@oleg-nenashev
Copy link
Member

@eis
It's waiting for the decision from the plugin maintainer (CC @hagzag).
🐝 from me, @reviewbybees done

@Evildethow
Copy link
Author

@hagzag are you able to merge this?

@oleg-nenashev
Copy link
Member

@Evildethow The recommendation is to start the e-mail thread in jenkinsci-dev and to Cc mentors there. If there is no response within 2 weeks, you will be eligible to request push permissions to the repo

@hashar
Copy link

hashar commented Jun 7, 2016

That might well fix all of:

https://issues.jenkins-ci.org/browse/JENKINS-31730
https://issues.jenkins-ci.org/browse/JENKINS-29671
https://issues.jenkins-ci.org/browse/JENKINS-27340

Apparently it used to work with rebuild plugin 1.21 . Might have been broken by #19

@hashar
Copy link

hashar commented Nov 17, 2017

I had this pull request applied on top of 1.25 and that solves the issue I was encountering. Maybe the commits can be squashed/rebased and that can get merged?

@GLundh
Copy link
Member

GLundh commented Nov 17, 2017

Does not these PR solve the same issues?
#45
#49

I was about to issue a new release the other week but ran into a few issues with the releasing and testing. I'll give it a new try next week.

@GLundh GLundh force-pushed the master branch 2 times, most recently from 370af40 to 316c049 Compare March 3, 2021 22:50
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