Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-55987

Use of when buildingTag does not work in Declarative pipeline

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      docker environment
    • Similar Issues:

      Description

      For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker
      I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project
       In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)}}
      I added the following line:
         when

           { buildingTag() }

       

      But every time I push a tag in gitlab, I have the message Stage skipped due to when conditional

      Attached the Jenkinsfile I'm using

      Context

      • Gitlab plugin version: 1.5.11
      • Gitlab CE version: 11.2.0
      • Jenkins version: 2.163
      • Job type: Pipeline (the pipeline plugins are up to date)

      Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

      Attached the console output triggered when after the push of a tag using the command:

      git push --tag origin master

       

       

      Is there something special to do to use the when tag or when buildingTag ? It seems to me I have done everything according to the documentation

        Attachments

          Activity

          dtronche Tronche Dominique created issue -
          dtronche Tronche Dominique made changes -
          Field Original Value New Value
          Description For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker
           I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project
           In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)
           I added the following line
           {{when \{ buildingTag() }}}
           But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_

          Here is the Jenkinsfile I'm using:

           

          {{pipeline {}}
          {{   agent any }}
          {{   stages {}}
          {{     stage('Build') {}}
          {{      steps {}}
          {{         gitlabCommitStatus(name:"build") {}}
          {{         script { }}
          {{           docker.withRegistry('Nexus URL', 'docker-pull-id') {}}
          {{              app = docker.build("my-project","--my proxy options") }}
          {{           }}}
          {{         }}}
          {{        } }}
          {{       }}}
          {{     }}}
          {{     stage('Push image') {}}
          {{       steps {}}
          {{         script { }}
          {{           docker.withRegistry('Nexus URL', 'docker-push-id') {}}
          {{           app.push("latest")}}
          {{         }}}
          {{        }}}
          {{      }}}
          {{     }}}
          {{     stage('Push tag image') {}}
          {{       when \{ buildingTag() }}}
          {{        steps {}}
          {{          script { }}
          {{             docker.withRegistry('Nexus URL', 'docker-pull-id')') {}}
          {{               app.push("tag")}}
          {{            }}}
          {{          }}}
          {{       }}}
          {{    }}}
          {{  }}}
          {{}}}
          h3. Context

          {{}}
           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

          {{}}

          {{}}

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation{{}}
          For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker
           I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project
           In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)
           I added the following line
           \{{when { buildingTag() }}}
           But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_

          Here is the Jenkinsfile I'm using:
          {{pipeline {
             agent any
             stages {
               stage('Build') {
                steps {
                   gitlabCommitStatus(name:"build") {
                   script {
                     docker.withRegistry('Nexus URL', 'docker-pull-id') {
                        app = docker.build("my-project","--my proxy options")
                     }
                   }
                  }
                 }
               }
               stage('Push image') {
                 steps {
                   script {
                     docker.withRegistry('Nexus URL', 'docker-push-id') {
                     app.push("latest")
                   }
                  }
                }
               }
               stage('Push tag image') {
                 when { buildingTag() }
                  steps {
                    script {
                       docker.withRegistry('Nexus URL', 'docker-pull-id')') {
                         app.push("tag")
                      }
                    }
                 }
              }
            }
          }
          }}
           
          h3. Context


           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

          {{}}

          {{}}

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation\{{}}
          dtronche Tronche Dominique made changes -
          Description For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker
           I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project
           In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)
           I added the following line
           \{{when { buildingTag() }}}
           But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_

          Here is the Jenkinsfile I'm using:
          {{pipeline {
             agent any
             stages {
               stage('Build') {
                steps {
                   gitlabCommitStatus(name:"build") {
                   script {
                     docker.withRegistry('Nexus URL', 'docker-pull-id') {
                        app = docker.build("my-project","--my proxy options")
                     }
                   }
                  }
                 }
               }
               stage('Push image') {
                 steps {
                   script {
                     docker.withRegistry('Nexus URL', 'docker-push-id') {
                     app.push("latest")
                   }
                  }
                }
               }
               stage('Push tag image') {
                 when { buildingTag() }
                  steps {
                    script {
                       docker.withRegistry('Nexus URL', 'docker-pull-id')') {
                         app.push("tag")
                      }
                    }
                 }
              }
            }
          }
          }}
           
          h3. Context


           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

          {{}}

          {{}}

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation\{{}}
          For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker
           I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project
           In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)
           I added the following line
           {{when

          { buildingTag() }}}
           But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_
           
           Here is the Jenkinsfile I'm using:
           {{pipeline {
           agent any
           stages {
           stage('Build') {
           steps {
           gitlabCommitStatus(name:"build") {
           script {
           docker.withRegistry('Nexus URL', 'docker-pull-id') \{ app = docker.build("my-project","--my proxy options") }
           }
           }
           }
           }
           stage('Push image') {
           steps {
           script {
           docker.withRegistry('Nexus URL', 'docker-push-id') \{ app.push("latest") }
           }
           }
           }
           stage('Push tag image') {
           when \{ buildingTag() }

          steps {
           script {
           docker.withRegistry('Nexus URL', 'docker-pull-id')')

          { app.push("tag") }

          }
           }
           }
           }
           }
           }}
            
          h3. Context
           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

          {{}}

          {{}}

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation\{{}}
          dtronche Tronche Dominique made changes -
          Description For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker
           I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project
           In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)
           I added the following line
           {{when

          { buildingTag() }}}
           But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_
           
           Here is the Jenkinsfile I'm using:
           {{pipeline {
           agent any
           stages {
           stage('Build') {
           steps {
           gitlabCommitStatus(name:"build") {
           script {
           docker.withRegistry('Nexus URL', 'docker-pull-id') \{ app = docker.build("my-project","--my proxy options") }
           }
           }
           }
           }
           stage('Push image') {
           steps {
           script {
           docker.withRegistry('Nexus URL', 'docker-push-id') \{ app.push("latest") }
           }
           }
           }
           stage('Push tag image') {
           when \{ buildingTag() }

          steps {
           script {
           docker.withRegistry('Nexus URL', 'docker-pull-id')')

          { app.push("tag") }

          }
           }
           }
           }
           }
           }}
            
          h3. Context
           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

          {{}}

          {{}}

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation\{{}}
          {{For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker}}
          {{ I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project}}
          {{ In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)}}
          {{ I added the following line}}
          {{ when}}{{{ buildingTag() }}}


           But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_

          Attached the Jenkinsfile I'm using


          h3. Context
           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

           

           

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation\{{}}
          Attachment Jenkinsfile [ 45938 ]
          dtronche Tronche Dominique made changes -
          Description {{For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker}}
          {{ I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project}}
          {{ In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)}}
          {{ I added the following line}}
          {{ when}}{{{ buildingTag() }}}


           But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_

          Attached the Jenkinsfile I'm using


          h3. Context
           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

           

           

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation\{{}}
          {{For our project we are using gitlab-ce and Jenkins to build docker images. I'm using a Pipeline Jenkinsfile to build my docker}}
          I suppose my jenkins job is correctly configured since the build is triggered each time I push a commit or a tag into my gitlab project
           In my pipeline, I have a stage I wish to be called only when a tag is pushed (git push --tag)}}
           I added the following line:
             when

               \{ buildingTag() }

           

          But every time I push a tag in gitlab, I have the message _Stage skipped due to when conditional_

          Attached the Jenkinsfile I'm using
          h3. Context
           * *Gitlab plugin version*: 1.5.11
           * *Gitlab CE version*: 11.2.0
           * *Jenkins version*: 2.163
           * *Job type*: Pipeline (the pipeline plugins are up to date)

          Our Jenkins docker container is based on image jenkins/jenkins:2.163-alpine

          Attached the console output triggered when after the push of a tag using the command:

          {{git push --tag origin master}}

           

           

          Is there something special to do to use the _when tag_ or _when buildingTag_ ? It seems to me I have done everything according to the documentation
          dotconnor Connor Love made changes -
          Rank Ranked higher

            People

            • Assignee:
              Unassigned
              Reporter:
              dtronche Tronche Dominique
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: