-
Notifications
You must be signed in to change notification settings - Fork 168
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-49488] implement any_met_condition flag for PromotionProcess.isMet() #115
base: master
Are you sure you want to change the base?
Conversation
…isMet() When any_met_condition flag is true, any met promotion condition would qualify for promote.
db9964d
to
eadb5b2
Compare
any updates on this PR? |
@dwnusbaum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather prefer an "OR" condition which groups other conditions, but it should do the job. minor changes are needed imho
if(b==null) | ||
return null; | ||
badges.add(b); | ||
LOGGER.log(Level.INFO, "PromotionProcess.isMet(): any_met_condition={0}", this.any_met_condition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logging does not help - PromotionProcess is not references in the entry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll remove this line
/** | ||
* Trigger promotion when any criteria condition is met. | ||
*/ | ||
public boolean any_met_condition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would advice against introducing any more public fields in the plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I use protected or private here?
I recall I hit an issue before when not using public.
yes, at beginning I was trying to use "Confitional Plugin" |
… for process-config.jelly to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things look mostly good now, the main thing that I think is left is to add some automated tests to show that the feature works.
/** | ||
* Trigger promotion when any criteria condition is met. | ||
*/ | ||
private boolean any_met_condition; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Java convention is to use camel case like anyMetCondition
.
return null; | ||
badges.add(b); | ||
if (this.any_met_condition) { | ||
if (b!=null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Since you're modifying these two if statements anyway, I think it would be good to go ahead and use braces around the conditional statements.
@@ -41,6 +41,11 @@ | |||
</select> | |||
</f:entry> | |||
|
|||
<f:entry title="Any_Met"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this what shows up in the UI? Maybe something like Promote if ANY of the above conditions are met
would be more clear to users, but I'm not sure what would be best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the screenshot! Maybe use Any Met
with no underscore?
Do you have an existing test case that's testing multiple conditions with "AND"? |
@totoroliu I think SelfPromotionTest#testBasic uses 2 self promotion conditions, so maybe you could use that but change one of them into a ManualCondition that you never trigger to show your new option works. |
JENKINS-49488: implement any_met_condition flag for PromotionProcess.isMet()
When any_met_condition flag is true,
any met promotion condition would qualify for promote.