[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Suganya Ravikumar edited a comment on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally We added the check to each stage and marked the build as ABORTED to prevent the build form going GREEN. ``` @NonCPS def call() { script { restartedFromStage = currentBuild.getBuildCauses().any{ cause -> cause._class == 'org.jenkinsci.plugins.pipeline.modeldefinition.causes.RestartDeclarativePipelineCause' }if (restartedFromStage){ error 'Restarting build from a stage is disabled. Please rerun build from start.' currentBuild.result = 'ABORTED' return false }else{ return true }} } ...``` in each stage we check ``` when { _expression_{ return call() }steps { ... ``` Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.194892.1540468831000.8372.1571176321416%40Atlassian.JIRA.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Suganya Ravikumar edited a comment on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally We added the check to each stage and marked the build as ABORTED to prevent the build form going GREEN. ``` @NonCPSdef call() {script {restartedFromStage = currentBuild.getBuildCauses().any { cause -> cause._class == 'org.jenkinsci.plugins.pipeline.modeldefinition.causes.RestartDeclarativePipelineCause'} if (restartedFromStage) { { error 'Restarting build from a stage is disabled. Please rerun build from start.' currentBuild.result = 'ABORTED' return false } else { { return true } }}... ``` in each stage we check ``` when { _expression_ { { return call() } steps {... ``` Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.194892.1540468831000.8355.1571176321170%40Atlassian.JIRA.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Suganya Ravikumar commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally We added the check to each stage and marked the build as ABORTED to prevent the build form going GREEN. @NonCPS def call() { script { restartedFromStage = currentBuild.getBuildCauses().any { cause -> cause._class == 'org.jenkinsci.plugins.pipeline.modeldefinition.causes.RestartDeclarativePipelineCause' } if (restartedFromStage) { error 'Restarting build from a stage is disabled. Please rerun build from start.' currentBuild.result = 'ABORTED' return false } else { return true } } } ... in each stage we check when { _expression_ { return call() } steps { ... Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.194892.1540468831000.8338.1571176260433%40Atlassian.JIRA.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Jo Rhett commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Alex Simenduev add it to a pipeline library as documented at https://jenkins.io/doc/book/pipeline/shared-libraries/#defining-custom-steps Thanks Jonathan Sokolowski but I wanted to point out this doesn't solve the situation for any stage which has a when section and is also a required build step. (GitHub accepts "I didn't do this stage" as pass ) Stage "Validate changed files" skipped due to this build restarting at stage "Run downstream jobs" [Pipeline] } [Pipeline] // stage [Pipeline] stage [Pipeline] { (Run downstream jobs) Stage "Run downstream jobs" skipped due to when conditional Build shows green, let's deploy! (facepalm) This really needs a global option. Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.194892.1540468831000.4086.1570672680496%40Atlassian.JIRA.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Chris Maes commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Jonathan Sokolowski thanks for the script, which works fine, but this scripts generates a expected to call pipeline.disableRestartFromStage but wound up catching script; see: https://jenkins.io/redirect/pipeline-cps-method-mismatches/ error. Is there any way to avoid this error? Add Comment This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.194892.1540468831000.2294.1570437780431%40Atlassian.JIRA.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Alex Simenduev commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Jonathan Sokolowski thanks for the script. Question, where do I put this shared step inside my pipeline? Do I must put it in each stage? Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-issues/JIRA.194892.1540468831000.3388.1560948000699%40Atlassian.JIRA. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Chris Hemp commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Previously I had the legacy UI hiding the "Restart from Stage" button with this css style (using the `simple-theme-plugin`): /* Hide Restart from Stage */ a[href$="restart"] {display: none;} This css style hiding solution was not an option in the Blue Ocean UI though. This helps, thanks Jonathan Sokolowski ! Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Jonathan Sokolowski edited a comment on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally I've written a shared pipeline script to achieve this as a workaround:{code:java}#!/usr/bin/env groovy@NonCPSdef call() {script {restartedFromStage = currentBuild. rawBuild.getCauses getBuildCauses ().any { cause ->cause. getClass().getName() _class == ~ /^ 'org . * jenkinsci.plugins.pipeline.modeldefinition.causes. RestartDeclarativePipelineCause $/ ' }if (restartedFromStage) {error 'Restarting build from a stage is disabled. Please rerun build from start.'}}}{code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Jonathan Sokolowski edited a comment on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally I've written a share shared pipeline script to achieve this as a workaround:{code:java}#!/usr/bin/env groovy@NonCPSdef call() {script {restartedFromStage = currentBuild.rawBuild.getCauses().any { cause ->cause.getClass().getName() ==~ /^.*RestartDeclarativePipelineCause$/}if (restartedFromStage) {error 'Restarting build from a stage is disabled. Please rerun build from start.'}}}{code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Jonathan Sokolowski commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally I've written a share pipeline script to achieve this as a workaround: #!/usr/bin/env groovy @NonCPS def call() { script { restartedFromStage = currentBuild.rawBuild.getCauses().any { cause -> cause.getClass().getName() ==~ /^.*RestartDeclarativePipelineCause$/ } if (restartedFromStage) { error 'Restarting build from a stage is disabled. Please rerun build from start.' } } } Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Sergiy Tupchiy commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally +1 Within k8s environment, using kubernetes-plugin, and running dynamic agents makes having this option obsolete. Also took some time, and still the case, to explain people in our company, how to properly restart the job, every time, that you should actually use "replay" in this case instead. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Manuel de la Peña commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Running in a swarm, where each job could be run in a different build agent, then this restart is useless from our use case: if the swarm chooses another build agent without the previous stages already run, then the executed one fails because of the absence of build artefacts (i.e.). If this build from stage is required, I'd enforce running within the same build agent Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Chris Hemp edited a comment on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Our pipelines are very similar to this where restarting at a stage is confusing and rebuilds are the only option.Pipeline stage skeleton: * Stage 1: Checkout with a package manager install : yarn install, mvn install, gradlew build --refresh-dependencies * Stages [1 or *]: tests * Stages [about 5]: CI/CD pipeline {{}}{{}}{{}} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Chris Hemp commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Our pipelines are very similar to this where restarting at a stage is confusing and rebuilds are the only option. Pipeline stage skeleton: Stage 1: Checkout with a package manager install : yarn install, mvn install, gradlew build --refresh-dependencies Stages [1 or *]: tests Stages [about 5]: CI/CD pipeline {{}} {{}} {{}} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Edward Maxwell-Lyte edited a comment on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Our company would also like this feature to ensure partial pipeline's pipelines can't be run. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Edward Maxwell-Lyte commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally Our company would also like this feature to ensure partial pipeline's can't be run. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Chris Maes commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally the restart stage button is very confusing for many people because way more visible than the global restart (for the whole pipeline)... so disabling that would be nice. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Jan Hoppe commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally That's right, disabling restart for all or a single stage would be great! Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Andrew Bayer commented on JENKINS-54250 Re: Disable restarting stages in jenkinsfile optionally It might be worthwhile to be able to disable restarting individual stages as well as the whole Pipeline. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Andrew Bayer updated an issue Jenkins / JENKINS-54250 Disable restarting stages in jenkinsfile optionally Change By: Andrew Bayer Labels: stage-restart-improvements Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-54250) Disable restarting stages in jenkinsfile optionally
Title: Message Title Jan Hoppe updated an issue Jenkins / JENKINS-54250 Disable restarting stages in jenkinsfile optionally Change By: Jan Hoppe Summary: Disable restarting stages in jenkinsfile optionally Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.