[JIRA] (JENKINS-54555) 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met
Title: Message Title Andrew Bayer updated JENKINS-54555 So the reasoning here is that we want to ensure that options like timeout or retry will apply across the entire stage execution, including, say, input (particularly relevant with timeout) and when. For your use case, you'd want to do something like this: steps { gitlabBuilds(builds: ['deploy']) { // Your actual steps } } ...rather than use options. Jenkins / JENKINS-54555 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met Change By: Andrew Bayer Status: Open Fixed but Unreleased Resolution: Not A Defect Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
[JIRA] (JENKINS-54555) 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met
Title: Message Title Alis Adrovic updated an issue Jenkins / JENKINS-54555 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met Change By: Alis Adrovic Summary: 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met 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-54555) ••••••••••••
Title: Message Title Alis Adrovic updated an issue Jenkins / JENKINS-54555 Change By: Alis Adrovic Summary: 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met 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-54555) 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met
Title: Message Title Alis Adrovic updated an issue Jenkins / JENKINS-54555 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met Change By: Alis Adrovic My(stripped out) Jenkinsfile looks like this:{{pipeline {}} {{ options {}} {{ gitlabBuilds(builds: ['prepare-build-environment', 'build'])}} } {{ stages {}} {{ //stages for preparing the build environment and building }}{{ stage('Deploy'){}} {{ when {}} {{ anyOf {}} {{ branch 'dev'}} {{ branch 'release'}} {{ branch 'master'}} \{{ } }} \{{ } }} {{ options {}} {{ gitlabBuilds(builds: ['deploy'])}} \{{ } }} {{ steps {}} {{ //my steps}} \{{ } }} {{ post {}} {{ failure {}} {{ updateGitlabCommitStatus name: 'deploy', state: 'failed'}} \{{ } }} {{ success {}} {{ updateGitlabCommitStatus name: 'deploy', state: 'success'}} \{{ }}} \{{ } }} \{{ } }} \{{ } }}{{ //more stuff}} } {{}}} Since I'm using Multibranch Pipeline, I don't want 'Deploy' stage to happen on feature branches. But GitLab gets notified about 'deploy' stage in all cases, and even if the Jenkins job finishes successfully, pipeline status on GitLab is still "running":!2018-11-09 11_14_34-Pipelines.png! This makes "Merge when pipeline succeeds" useless, since it will never succeed. Add Comment
[JIRA] (JENKINS-54555) 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met
Title: Message Title Alis Adrovic updated an issue Jenkins / JENKINS-54555 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met Change By: Alis Adrovic My(stripped out) Jenkinsfile looks like this:{{pipeline {}}{{ options {}}{{ gitlabBuilds(builds: ['prepare-build-environment', 'build'])}} {{ } }} {{ stages {}}{{ //stages for preparing the build environment and building }}{{ stage('Deploy'){}}{{ when {}}{{ anyOf {}}{{ branch 'dev'}}{{ branch 'release'}}{{ branch 'master'}} \ {{ }}} \ {{ }}}{{ options {}}{{ gitlabBuilds(builds: ['deploy'])}} \ {{ }}}{{ steps {}}{{ //my steps}} \ {{ }}}{{ post {}}{{ failure {}}{{ updateGitlabCommitStatus name: 'deploy', state: 'failed'}} \ {{ }}}{{ success {}}{{ updateGitlabCommitStatus name: 'deploy', state: 'success'}} \ {{ }}} \ {{ }}} \ {{ }}} \ {{ }}}{{ //more stuff}}{{}}}Since I'm using Multibranch Pipeline, I don't want 'Deploy' stage to happen on feature branches. But GitLab gets notified about 'deploy' stage in all cases, and even if the Jenkins job finishes successfully, pipeline status on GitLab is still "running":!2018-11-09 11_14_34-Pipelines.png! This makes "Merge when pipeline succeeds" useless, since it will never succeed. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
[JIRA] (JENKINS-54555) 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met
Title: Message Title Alis Adrovic created an issue Jenkins / JENKINS-54555 'stage' directive with nested 'when' and 'options' directives executes the 'options' block even if the condition is not met Issue Type: Bug Assignee: Andrew Bayer Attachments: 2018-11-09 11_14_34-Pipelines.png Components: pipeline-model-definition-plugin Created: 2018-11-09 10:22 Labels: pipeline plugin Priority: Minor Reporter: Alis Adrovic My(stripped out) Jenkinsfile looks like this: pipeline { options { gitlabBuilds(builds: ['prepare-build-environment', 'build']) {{ }}} stages { //stages for preparing the build environment and building stage('Deploy'){ when { anyOf { branch 'dev' branch 'release' branch 'master' {{ }}} {{ }}} options { gitlabBuilds(builds: ['deploy']) {{ }}} steps { //my steps {{ }}} post { failure { updateGitlabCommitStatus name: 'deploy', state: 'failed' {{ }}} success { updateGitlabCommitStatus name: 'deploy', state: 'success' {{ }}} {{ }}} {{ }}} {{ }}} //more stuff } Since I'm using Multibranch Pipeline, I don't want 'Deploy' stage to happen on feature branches. But GitLab gets notified about 'deploy' stage in all cases, and even if the Jenkins job finishes successfully, pipeline status on GitLab is still "running": This makes "Merge when pipeline succeeds" useless, since it will never succeed.