Skip to content

Commit

Permalink
Fix jenkinsci#499 by prioritizing trigger phrase over retest phrase
Browse files Browse the repository at this point in the history
  • Loading branch information
mabrowning committed Oct 17, 2019
1 parent f4eb4bc commit 70b1c65
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/main/java/org/jenkinsci/plugins/ghprb/GhprbPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -607,16 +607,11 @@ private void checkComment(GHIssueComment comment) throws IOException {
} else if (helper.isOktotestPhrase(body) && helper.isAdmin(sender)) { // ok to test
LOGGER.log(Level.FINEST, "Admin {0} gave OK to test", sender);
setAccepted(true);
} else if (helper.isRetestPhrase(body)) { // test this please
LOGGER.log(Level.FINEST, "Retest phrase");
if (helper.isAdmin(sender)) {
LOGGER.log(Level.FINEST, "Admin {0} gave retest phrase", sender);
shouldRun = true;
} else if (accepted && helper.isWhitelisted(sender)) {
LOGGER.log(Level.FINEST, "Retest accepted and user {0} is whitelisted", sender);
shouldRun = true;
}
} else if (helper.isTriggerPhrase(body)) { // trigger phrase
// The trigger phrase is prioritized over retest phrase because it
// encomposes the logic of retestPhrase (shouldRun = true), but also
// sets the triggered flag, which is important when the job is
// configured to "Only use trigger phrase for build triggering"
LOGGER.log(Level.FINEST, "Trigger phrase");
if (helper.isAdmin(sender)) {
LOGGER.log(Level.FINEST, "Admin {0} ran trigger phrase", sender);
Expand All @@ -627,6 +622,15 @@ private void checkComment(GHIssueComment comment) throws IOException {
shouldRun = true;
triggered = true;
}
} else if (helper.isRetestPhrase(body)) { // test this please
LOGGER.log(Level.FINEST, "Retest phrase");
if (helper.isAdmin(sender)) {
LOGGER.log(Level.FINEST, "Admin {0} gave retest phrase", sender);
shouldRun = true;
} else if (accepted && helper.isWhitelisted(sender)) {
LOGGER.log(Level.FINEST, "Retest accepted and user {0} is whitelisted", sender);
shouldRun = true;
}
}

if (shouldRun) {
Expand Down

0 comments on commit 70b1c65

Please sign in to comment.