Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1101 from daspilker/JENKINS-47705
[JENKINS-47705] fixed "Disable removed jobs" for Pipeline jobs
  • Loading branch information
daspilker committed Jan 31, 2018
2 parents c29f3fb + c99f2e6 commit 7eb930e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions docs/Home.md
Expand Up @@ -45,6 +45,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
([#1086](https://github.com/jenkinsci/job-dsl-plugin/pull/1086))
* Enhanced support for the [Git Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin)
([#1087](https://github.com/jenkinsci/job-dsl-plugin/pull/1087))
* Fixed "Disable removed jobs" for Pipeline jobs
([JENKINS-47705](https://issues.jenkins-ci.org/browse/JENKINS-47705))
* Changed the default script path for Pipeline `cpsScm` context to `Jenkinsfile`, see
[Migration](Migration#migrating-to-168)
* Changed the `sendTo` recipient list to be empty by default for the
Expand Down
Expand Up @@ -13,7 +13,6 @@
import hudson.Util;
import hudson.model.AbstractBuild;
import hudson.model.AbstractItem;
import hudson.model.AbstractProject;
import hudson.model.Item;
import hudson.model.ItemGroup;
import hudson.model.Items;
Expand All @@ -40,6 +39,7 @@
import javaposse.jobdsl.plugin.actions.GeneratedViewsAction;
import javaposse.jobdsl.plugin.actions.GeneratedViewsBuildAction;
import jenkins.model.Jenkins;
import jenkins.model.ParameterizedJobMixIn.ParameterizedJob;
import jenkins.tasks.SimpleBuildStep;
import org.acegisecurity.AccessDeniedException;
import org.apache.commons.io.FilenameUtils;
Expand Down Expand Up @@ -429,13 +429,10 @@ private void updateGeneratedJobs(final Job seedJob, TaskListener listener,
removedItem.delete();
removed.add(unreferencedJob);
} else {
if (removedItem instanceof AbstractProject) {
AbstractProject project = (AbstractProject) removedItem;
if (removedItem instanceof ParameterizedJob) {
ParameterizedJob project = (ParameterizedJob) removedItem;
project.checkPermission(Item.CONFIGURE);
if (project.isInQueue()) {
project.checkPermission(Item.CANCEL); // disable() will cancel queued builds
}
project.disable();
project.makeDisabled(true);
disabled.add(unreferencedJob);
}
}
Expand Down

0 comments on commit 7eb930e

Please sign in to comment.