Skip to content
Permalink
Browse files
fixed "Disable removed jobs" for Pipeline jobs
[FIXES JENKINS-47705]
  • Loading branch information
daspilker committed Jan 31, 2018
1 parent c29f3fb commit c99f2e6193292a4644f01dc1cc4be09f7d3b6bb5
Showing with 6 additions and 7 deletions.
  1. +2 −0 docs/Home.md
  2. +4 −7 job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/ExecuteDslScripts.java
@@ -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
@@ -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;
@@ -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;
@@ -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);
}
}

0 comments on commit c99f2e6

Please sign in to comment.