Skip to content

Commit

Permalink
Merge pull request #497 from TWestling/jenkins-71789
Browse files Browse the repository at this point in the history
Fix for JENKINS-71789
  • Loading branch information
rsandell committed Aug 25, 2023
2 parents dd757d5 + cd8035b commit 3314aae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -72,7 +72,7 @@
<dependency>
<groupId>com.sonymobile.tools.gerrit</groupId>
<artifactId>gerrit-events</artifactId>
<version>2.19.0</version>
<version>2.21.0</version>
<exclusions>
<!-- Provided by core -->
<exclusion>
Expand Down
Expand Up @@ -253,11 +253,13 @@ public boolean shouldTriggerOn(GerritTriggeredEvent event) {
return true;
}
if (excludeTrivialRebase
&& GerritChangeKind.TRIVIAL_REBASE == ((PatchsetCreated)event).getPatchSet().getKind()) {
&& (GerritChangeKind.TRIVIAL_REBASE == ((PatchsetCreated)event).getPatchSet().getKind()
|| GerritChangeKind.NO_CHANGE == ((PatchsetCreated)event).getPatchSet().getKind())) {
return false;
}
if (excludeNoCodeChange
&& GerritChangeKind.NO_CODE_CHANGE == ((PatchsetCreated)event).getPatchSet().getKind()) {
&& (GerritChangeKind.NO_CODE_CHANGE == ((PatchsetCreated)event).getPatchSet().getKind()
|| GerritChangeKind.NO_CHANGE == ((PatchsetCreated)event).getPatchSet().getKind())) {
return false;
}
if (excludePrivateState && ((PatchsetCreated)event).getChange().isPrivate()) {
Expand Down
Expand Up @@ -54,6 +54,7 @@ public void shouldNotFireOnDraftPatchsetWhenExcluded() {

/**
* Tests that it should not fire on trivial rebase when they are excluded.
* Also tests that we don't fire for no change while ignoring trivial rebases.
* @author Doug Kelly &lt;dougk.ff7@gmail.com&gt;
*/
@Test
Expand All @@ -68,10 +69,13 @@ public void shouldNotFireOnTrivialRebaseWhenExcluded() {
assertTrue(pluginPatchsetCreatedEvent.shouldTriggerOn(patchsetCreated));
patchsetCreated.getPatchSet().setKind(GerritChangeKind.TRIVIAL_REBASE);
assertFalse(pluginPatchsetCreatedEvent.shouldTriggerOn(patchsetCreated));
patchsetCreated.getPatchSet().setKind(GerritChangeKind.NO_CHANGE);
assertFalse(pluginPatchsetCreatedEvent.shouldTriggerOn(patchsetCreated));
}

/**
* Tests that it should not fire on no code changes when they are excluded.
* Also tests that we don't fire for no change while ignoring no code change.
* @author Doug Kelly &lt;dougk.ff7@gmail.com&gt;
*/
@Test
Expand All @@ -86,6 +90,8 @@ public void shouldNotFireOnNoCodeChangeWhenExcluded() {
assertTrue(pluginPatchsetCreatedEvent.shouldTriggerOn(patchsetCreated));
patchsetCreated.getPatchSet().setKind(GerritChangeKind.NO_CODE_CHANGE);
assertFalse(pluginPatchsetCreatedEvent.shouldTriggerOn(patchsetCreated));
patchsetCreated.getPatchSet().setKind(GerritChangeKind.NO_CHANGE);
assertFalse(pluginPatchsetCreatedEvent.shouldTriggerOn(patchsetCreated));
}

/**
Expand Down

0 comments on commit 3314aae

Please sign in to comment.