Skip to content

Add custom labels setup & config#1

Open
shemuwel wants to merge 7 commits intomasterfrom
custom_label
Open

Add custom labels setup & config#1
shemuwel wants to merge 7 commits intomasterfrom
custom_label

Conversation

@shemuwel
Copy link
Copy Markdown
Collaborator

- moved build status votes fields to VerdictCategory instead of having
them as private fields in Config/GerritTrigger & mark their
getters/setters deprecated
- remove the entries for the removed status votes from jelly
gerrit-trigger config & add them in VerdictCategory list
instead (all the votes are set within VerdictCategory)
- votes are now part of the VerdictCategory list (categories) so all
deprecated methods are now searching through the list instead
- some methods are redundant (containing 'verified' name although
a simpler form already exists)
- extact default gerrit commands to static fields instead
- deprecate verified/code-review minimum vote calculation
methods
- create string based label methods for minimum voting calcs
and aggregate all categories (verified & code-review included) into
the templated command allowing them to be expanded later all together
- remove redundant test (in which the scenario was testing the min.
voting calculation for the Verified label by using its associated method
instead of testing the scenario via getBuildCompletedCommand)
- update tests to check for the newly added custom label
if (categories.isEmpty()) {
categories.add(new VerdictCategory("Code-Review", "Code Review"));
categories.add(new VerdictCategory("Verified", "Verified"));
categories.add(new VerdictCategory(Constants.CODE_REVIEW_LABEL, Constants.CODE_REVIEW_LABEL));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This looks wrong? One is "Code-Review", and the other is "Code-Review"... Or we want to display the same value as the actual label? 🤔

* Returns the value formatted as a placeholder.
* @return the value formatted as a placeholder.
*/
public String getPlaceholderValue() {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not super clear where this is used, I can't find usages.

Comment on lines +64 to +69
Integer buildStartedVote,
Integer buildSuccessfulVote,
Integer buildFailedVote,
Integer buildUnstableVote,
Integer buildNotBuiltVote,
Integer buildAbortedVote) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Don't think "VerdictCategory" should be combined with the Vote, but rather have a separate class (which potentially composes this class to store the verdict for which the votes are for)

if (result == Result.ABORTED)
return BuildStatus.ABORTED;

return BuildStatus.FAILED;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sounds like NOT_REGISTERED should be here, no?

for (Object jsonObject : (JSONArray)cat) {
categories.add(VerdictCategory.fromJSON((JSONObject) jsonObject));
}
} else if (cat instanceof JSONObject) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should probably throw here if none of the checks match? i.e., unknown type.

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.

3 participants