-
Bug
-
Resolution: Fixed
-
Minor
-
1.580+
-
Powered by SuggestiMate
Currently the Disable Build function is available as part of AbstractProject. This should be refactored out to a place where WorkflowJob can also inherit the functionality.
- blocks
-
JENKINS-36081 Pipelines need to be marked as disabled when disabled
-
- Reopened
-
- is blocked by
-
JENKINS-44619 ReplayAction should check Job.isBuildable
-
- Resolved
-
- is blocking
-
JENKINS-47705 "Disable removed jobs" feature does not work with pipeline jobs
-
- Closed
-
-
JENKINS-31345 Should be a simple way to disable a workflow
-
- Resolved
-
-
JENKINS-36632 Pipeline support
-
- Closed
-
- is duplicated by
-
JENKINS-33821 Pipeline job s can`t be disabled
-
- Resolved
-
- relates to
-
JENKINS-49307 Disabling Jenkins pipeline (workflow) removes next build from queue
-
- Open
-
-
JENKINS-40521 Orphaned branch projects should not be considered buildable
-
- Resolved
-
-
JENKINS-34716 Add REST API polling to Pipeline
-
- Resolved
-
- links to
[JENKINS-27299] Refactor Disable Build feature out of AbstractProject for Pipeline Compatibility
mswyatt This is the original issue you should track for disabling workflows; the CLI command is just piggybacking on AbstractBuild's methods.
It would be nice if we can enable/disable the workflow job.
I configured it to run in cycle and handle many other jobs with various criteria and keep running. Only I can stop it and re-run it but cant disable it so that when required it got enabled and then started again with any jenkins admin.
This is a core feature in my mind. I'd love to see it fixed/added. Thanks!
I took a shot at adding disable support to pipeline jobs in two pull requests:
https://github.com/jenkinsci/jenkins/pull/2543
https://github.com/jenkinsci/workflow-job-plugin/pull/22
I haven't done Jenkins development before though, so I'm not sure this is the right way to go about it.
+1 for this feature!
There are so many scenarios that require a job to be disabled that I also think that this is a core feature.
+1 I am loving pipelines, but keep finding various small things that seem to be missing even when they seem important.
Folks, it's not helpful to keep posting +1 comments. This generates a fairly pointless email to everyone who is watching this issue. If you want the feature, just add a vote. Thanks.
There is a pull request pending to the Jenkins core.
If somebody is interested to get it sooner, please feel free to contribute by reviewing and testing the changes (or proposing your own PRs).
Most of the onus is on me to review it, probably. I have not had time.
jglick: Any news ? We need this functionality to be able to disable or enable release jobs from criterias in other jobs.
Is this being actively worked on? There are a lot of votes for it, and it's really inconvenient that pipeline builds can't straightforwardly be temporarily disabled.
What is the current status of this issue? This is major issue, can we change the priority?
Nobody pays attention to the priority field. This is on my to-do list. I have not had time to work on it yet.
I feel like this should be a higher priority. This makes using pipeline in conjunction with job dsl difficult.
Having Disable Build/Project feature for pipelines would be somewhat a workaround for Safe Restart, since Safe Restart is broken for many pipeline steps. It's a pain to maintain Jenkins having many loooong pipelines. Keeps us away from droping Build Flow plugin completely in favour of pipeline.
Was really surprised disabling pipeline builds was not supported. +1 for resolving this issue.
This is becoming critical to our decision of whether to move from Build Flow to Pipeline for the majority of our projects.
The fact that we cannot simply disable a pipeline job hurts.
Is this related to being able to disable/enable a multi-branch pipeline/job from the Jenkins UI in any way?
Assuming in a Jenkinsfile run I decide to disable some jobs, e.g:
post {
failure {
script {
def job = Jenkins.instance.getItem("job-name");
job.disable();
}
}
}
If this actually works, how could I then enable it given there is no button in the UI to enable/disable a multi-branch job.
disable/enable a multi-branch pipeline/job
Multibranch Pipelines are basically folders with some additional behavior, the actual Pipeline jobs are the individual branches. AFAIUI, this is about the latter.
Yep. Btw, the two PRs in question working in tandem work to fix this issue. With just the workflow PR merged, we get some disabling (UI), disabling through manual DSL disable(), but a good number of plugins will view the job as not disabled, and the automatic DSL disable functionality doesn't work. Both PRs together seem to do what is intended.
https://github.com/jenkinsci/workflow-job-plugin/pull/23
https://github.com/jenkinsci/jenkins/pull/2544
Thanks for the explanation. Hopefully this ticket will happen sooner than later...
Here is a workaround which works for me when using Git:
Enable Ignore on push notifications in section Branch Sources of the pipeline job configuration. This way the job is not triggered upon a new commit. But please note that saving the configuration may trigger a branch scan.
I cannot use push notifications, so my own workaround is to create a freestyle "trigger" job which polls SCM and use the Parameterized Trigger plugin to trigger the pipeline job (standard trigger mechanism cannot be used with pipeline, another broken feature). I can then enable/disable the "trigger".
We used to use separate trigger jobs, but for the particular type of workflow we're trying to move towards (where pipelines really help us) a trigger job is actually a bit of an inconvenience.
Code changed in jenkins
User: Jesse Glick
Path:
pom.xml
src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java
src/main/resources/org/jenkinsci/plugins/workflow/job/WorkflowJob/configure-entries.jelly
src/main/resources/org/jenkinsci/plugins/workflow/job/WorkflowJob/main.jelly
src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java
src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunRestartTest.java
src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowRunTest.java
http://jenkins-ci.org/commit/workflow-job-plugin/d1874be4417070ed07289faf0dd4ab5032e0b58f
Log:
Merge pull request #46 from jglick/WorkflowJob.disabled-JENKINS-27299
JENKINS-27299 WorkflowJob.disabled
Compare: https://github.com/jenkinsci/workflow-job-plugin/compare/cc4923e5d8ce...d1874be44170
Code changed in jenkins
User: Jesse Glick
Path:
cli/pom.xml
core/move-l10n.groovy
core/pom.xml
core/src/main/java/hudson/cli/BuildCommand.java
core/src/main/java/hudson/cli/declarative/CLIRegisterer.java
core/src/main/java/hudson/cli/handlers/ParameterizedJobOptionHandler.java
core/src/main/java/hudson/model/AbstractItem.java
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/ListView.java
core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java
core/src/main/java/jenkins/triggers/SCMTriggerItem.java
core/src/main/resources/hudson/model/AbstractProject/main.jelly
core/src/main/resources/hudson/model/AbstractProject/makeDisabled.jelly
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ar.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_bg.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ca.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_cs.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_da.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_de.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_es.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_et.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_fi.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_fr.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_he.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_hu.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_it.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ja.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ko.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_lt.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_lv.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_nb_NO.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_nl.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pl.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pt_BR.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_pt_PT.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ro.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_ru.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sk.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sl.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sr.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_sv_SE.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_tr.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_uk.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_zh_CN.properties
core/src/main/resources/hudson/model/AbstractProject/makeDisabled_zh_TW.properties
core/src/main/resources/hudson/model/Messages.properties
core/src/main/resources/hudson/model/Messages_bg.properties
core/src/main/resources/hudson/model/Messages_da.properties
core/src/main/resources/hudson/model/Messages_de.properties
core/src/main/resources/hudson/model/Messages_es.properties
core/src/main/resources/hudson/model/Messages_it.properties
core/src/main/resources/hudson/model/Messages_ja.properties
core/src/main/resources/hudson/model/Messages_lt.properties
core/src/main/resources/hudson/model/Messages_pt_BR.properties
core/src/main/resources/hudson/model/Messages_sr.properties
core/src/main/resources/hudson/model/Messages_zh_TW.properties
core/src/main/resources/jenkins/model/Messages.properties
core/src/main/resources/jenkins/model/Messages_bg.properties
core/src/main/resources/jenkins/model/Messages_da.properties
core/src/main/resources/jenkins/model/Messages_de.properties
core/src/main/resources/jenkins/model/Messages_es.properties
core/src/main/resources/jenkins/model/Messages_it.properties
core/src/main/resources/jenkins/model/Messages_ja.properties
core/src/main/resources/jenkins/model/Messages_lt.properties
core/src/main/resources/jenkins/model/Messages_pt_BR.properties
core/src/main/resources/jenkins/model/Messages_sr.properties
core/src/main/resources/jenkins/model/Messages_zh_TW.properties
core/src/main/resources/lib/hudson/project/config-disableBuild.jelly
core/src/main/resources/lib/hudson/project/makeDisabled.jelly
core/src/main/resources/lib/hudson/project/makeDisabled_ar.properties
core/src/main/resources/lib/hudson/project/makeDisabled_bg.properties
core/src/main/resources/lib/hudson/project/makeDisabled_ca.properties
core/src/main/resources/lib/hudson/project/makeDisabled_cs.properties
core/src/main/resources/lib/hudson/project/makeDisabled_da.properties
core/src/main/resources/lib/hudson/project/makeDisabled_de.properties
core/src/main/resources/lib/hudson/project/makeDisabled_es.properties
core/src/main/resources/lib/hudson/project/makeDisabled_et.properties
core/src/main/resources/lib/hudson/project/makeDisabled_fi.properties
core/src/main/resources/lib/hudson/project/makeDisabled_fr.properties
core/src/main/resources/lib/hudson/project/makeDisabled_he.properties
core/src/main/resources/lib/hudson/project/makeDisabled_hu.properties
core/src/main/resources/lib/hudson/project/makeDisabled_it.properties
core/src/main/resources/lib/hudson/project/makeDisabled_ja.properties
core/src/main/resources/lib/hudson/project/makeDisabled_ko.properties
core/src/main/resources/lib/hudson/project/makeDisabled_lt.properties
core/src/main/resources/lib/hudson/project/makeDisabled_lv.properties
core/src/main/resources/lib/hudson/project/makeDisabled_nb_NO.properties
core/src/main/resources/lib/hudson/project/makeDisabled_nl.properties
core/src/main/resources/lib/hudson/project/makeDisabled_pl.properties
core/src/main/resources/lib/hudson/project/makeDisabled_pt_BR.properties
core/src/main/resources/lib/hudson/project/makeDisabled_pt_PT.properties
core/src/main/resources/lib/hudson/project/makeDisabled_ro.properties
core/src/main/resources/lib/hudson/project/makeDisabled_ru.properties
core/src/main/resources/lib/hudson/project/makeDisabled_sk.properties
core/src/main/resources/lib/hudson/project/makeDisabled_sl.properties
core/src/main/resources/lib/hudson/project/makeDisabled_sr.properties
core/src/main/resources/lib/hudson/project/makeDisabled_sv_SE.properties
core/src/main/resources/lib/hudson/project/makeDisabled_tr.properties
core/src/main/resources/lib/hudson/project/makeDisabled_uk.properties
core/src/main/resources/lib/hudson/project/makeDisabled_zh_CN.properties
core/src/main/resources/lib/hudson/project/makeDisabled_zh_TW.properties
pom.xml
test/src/test/groovy/hudson/cli/EnableJobCommandTest.groovy
test/src/test/java/hudson/cli/EnableJobCommandTest.java
http://jenkins-ci.org/commit/jenkins/3af0cc68cb1cea3047a21400486c075f1b555cf2
Log:
JENKINS-27299 Define disabled in ParameterizedJob rather than AbstractProject (#2866)
- Offering default methods on ParameterizedJob.
- Javadoc typo.
- Cleaner use of default methods in ParameterizedJob.
- Need to pick up https://github.com/infradna/bridge-method-injector/pull/15 to be able to build.
- Sketch of pulling disabled functionality into ParameterizedJob.
- EnableJobCommandTest.groovy → EnableJobCommandTest.java, and replacing deprecated Remoting-based CLI calls with CLICommandInvoker.
- All CLI commands could be broken by a missing CLI.*.shortDescription key on just one!
- Forgot to move CLI method short descriptions to new package.
- Needed a @CLIResolver for ParameterizedJob. Adding an OptionHandler while we are here.
- Trying to fix up access-modifier versions; started failing in CI today for unknown reasons.
- Introduced <p:makeDisabled/> by analogy with <p:config-disableBuild/>.
- Using new type bounds.
- access-modifier 1.11 released.
- MatrixProject and MavenModuleSet both expect to have access to makeDisabled.jelly.
- Trying to generalize some more.
- Minor simplification.
JENKINS-34716Generalizing doPolling and schedulePolling.
- isBuildable
- Obsolete comment.
- Updated comments.
- bridge-method-injector 1.17
- Unfortunately AbstractProject.schedulePolling cannot delegate to SCMTriggerItem.
- bridge-method-injector 1.17
I've seen in the video of Cloudbees that the disable won't work on multibranch pipeline. Is there a way to disable the jobs generated from multibranch pipeline from polling?
There were already separate features designed to suppress commit triggers on branch projects, as discussed in the video. This is more a question for the user list.Is there a way to disable the jobs generated from multibranch pipeline from polling?
I still hope we will see a user friendly option for disabling builds, on all kinds of jobs. The number of watchers on this ticket is a clear sign that something went wrong in the architecture phase of the pipelines.
Are not going towards a direction where we keep documentation inside videos? ...not to mention that the mentioned video is not even linked to this issue.
There is no plan for any feature permitting branch projects to be disabled per se. stephenconnolly argued against it and I agree. Anyway that would be a separate (linked) RFE.
Code changed in jenkins
User: Jesse Glick
Path:
src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowJob.java
src/main/resources/org/jenkinsci/plugins/workflow/job/WorkflowJob/main.jelly
src/test/java/org/jenkinsci/plugins/workflow/job/WorkflowJobTest.java
http://jenkins-ci.org/commit/workflow-job-plugin/8da02e98393c64ebe0f3500e20462adff50c6e67
Log:
Merge pull request #47 from jglick/WorkflowJob.disabled+core-JENKINS-27299
JENKINS-27299 WorkflowJob.disabled on new core
Compare: https://github.com/jenkinsci/workflow-job-plugin/compare/5a6f27764fbe...8da02e98393c
jglick, trying to understand where the fix is...
I've installed the Pipeline: Job plugin where the fix is. Now I'm looking at my multi-branch job, its main screen, the branch screen, the pull requests screen and in none one them do I see an enable/disable button.
When looking at the branch screen though, there is a "view configuration" button and there, under "Build Triggers" I do see "disable this project" with the following description:
When this option is checked, no new builds of this project will be executed. This can be helpful when you want to temporarily prevent a project from being built. For example, if your project depends on some infrastructure — e.g. a test server, or a source code repository — and you know it will be unavailable for a period of time, you could disable the project to prevent unnecessary build failures (and any corresponding notifications) during this period. You can also disable (or re-enable) this project by clicking the Disable Project (or Enable Project) button on this project's main page.
So am I supppose to see this somewhere in this job type? if not, what are our options for this case?
So in this context what does "per se" mean? If there isn't should we ditch the multi branch job type then?
Again there are other ways to suppress triggering of builds from branch projects.
From another dimension:
Here is your new car which looks great and even has an auto-pilot. BTW, we removed the break pedal because it was taking too much space and we moved it inside the trunk. Ask on the forum and people will tell you how they managed to use it.
This seems solved, however running recent versions of jenkins i cannot see how to disable builds. neither on specific branches or on repositories with multiple branches. Is there any documentation anywhere?
You would need to be logged in as a user who has access to write/configure builds. And if the build is Pipeline Multibranch you still won't see the disable button. If that's the case, you can append /disable to the project URL to disable it.
For a normal pipeline job I now have the button and can disable it, however it does not appear in views that filter on disabled jobs (List View section, Job Statuses Filter). Is this another bug that should be reported separately because it probably belongs to another component? If so, could you give me a hint which component this might belong to?
Might be https://plugins.jenkins.io/view-job-filters if you're using that, but core's List view also has a boolean flag to only include enabled jobs. Either, or both.
I had no immediate plans to work on it.
I suspect ParameterizedJobMixIn is the right home for this, though I have not analyzed it in detail; would just need to try doing the refactoring and see what kind of trouble ensues.