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

Using environment in when block leads to unknown conditional error

      After updating to the latest version of the Pipeline Model Definition Plugin I get the following error:

       

      WorkflowScript: 43: Unknown conditional error. Valid conditionals are: allOf, anyOf, branch, changelog, changeset, environment, expression, not @ line 43, column 21.
       environment name: 'CONTINUE', value: 'yes'
       ^

      The whole block looks like this

      stage('stage') {
        when {
          environment name: 'CONTINUE', value: 'yes'
        }
        steps {
          do something
        }
      }
      

          [JENKINS-47053] Using environment in when block leads to unknown conditional error

          Waldemar Wukowa created issue -
          Waldemar Wukowa made changes -
          Description Original: After updating to the latest version of the Pipeline Model Definition Plugin I get the following error:

           
          {code:java}
          WorkflowScript: 43: Unknown conditional error. Valid conditionals are: allOf, anyOf, branch, changelog, changeset, environment, expression, not @ line 43, column 21.
           environment name: 'CONTINUE', value: 'yes'
           ^{code}
          The whole block looks like this
          {code:java}
          stage('stage') {
            when {
              expression { env.CONTINUE_DEPLOYMENT == 'yes' }
            }
            steps {
              do something
            }
          }
          {code}
          New: After updating to the latest version of the Pipeline Model Definition Plugin I get the following error:

           
          {code:java}
          WorkflowScript: 43: Unknown conditional error. Valid conditionals are: allOf, anyOf, branch, changelog, changeset, environment, expression, not @ line 43, column 21.
           environment name: 'CONTINUE', value: 'yes'
           ^{code}
          The whole block looks like this
          {code:java}
          stage('stage') {
            when {
              expression { env.CONTINUE == 'yes' }
            }
            steps {
              do something
            }
          }
          {code}
          Waldemar Wukowa made changes -
          Priority Original: Major [ 3 ] New: Minor [ 4 ]
          Waldemar Wukowa made changes -
          Description Original: After updating to the latest version of the Pipeline Model Definition Plugin I get the following error:

           
          {code:java}
          WorkflowScript: 43: Unknown conditional error. Valid conditionals are: allOf, anyOf, branch, changelog, changeset, environment, expression, not @ line 43, column 21.
           environment name: 'CONTINUE', value: 'yes'
           ^{code}
          The whole block looks like this
          {code:java}
          stage('stage') {
            when {
              expression { env.CONTINUE == 'yes' }
            }
            steps {
              do something
            }
          }
          {code}
          New: After updating to the latest version of the Pipeline Model Definition Plugin I get the following error:

           
          {code:java}
          WorkflowScript: 43: Unknown conditional error. Valid conditionals are: allOf, anyOf, branch, changelog, changeset, environment, expression, not @ line 43, column 21.
           environment name: 'CONTINUE', value: 'yes'
           ^{code}
          The whole block looks like this
          {code:java}
          stage('stage') {
            when {
              environment name: 'CONTINUE', value: 'yes'
            }
            steps {
              do something
            }
          }
          {code}
          Waldemar Wukowa made changes -
          Attachment New: Jenkinsfile [ 39819 ]
          Andrew Bayer made changes -
          Resolution New: Not A Defect [ 7 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Liam Newman made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            abayer Andrew Bayer
            riffert Waldemar Wukowa
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: