Skip to content

Commit

Permalink
[FIXED JENKINS-44619] Don't allow replays of nonbuildable jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
abayer committed Sep 18, 2017
1 parent 3396c97 commit 42f6682
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -139,7 +139,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>2.10</version>
<version>2.11.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Expand Up @@ -115,6 +115,11 @@ private ReplayAction(Run run) {
if (!run.hasPermission(REPLAY)) {
return false;
}

if (!run.getParent().isBuildable()) {
return false;
}

CpsFlowExecution exec = getExecution();
if (exec == null) {
return false;
Expand Down
Expand Up @@ -171,6 +171,12 @@ public static void assertPermissionId() {
assertTrue(canReplay(b2, "dev1"));
assertTrue(canReplay(b2, "dev2"));
assertFalse(canReplay(b2, "dev3"));
// Disable the job and verify that no one can replay it.
p.makeDisabled(true);
assertFalse(canReplay(b2, "admin"));
assertFalse(canReplay(b2, "dev1"));
assertFalse(canReplay(b2, "dev2"));
assertFalse(canReplay(b2, "dev3"));
}
});
}
Expand Down

0 comments on commit 42f6682

Please sign in to comment.