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

When using blueocean-pipeline editor with when conditions in JenkinsFile we get errors about "Empty closure" and "Expected When Condition"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None

      When using blueocean-pipeline editor with when conditions in JenkinsFile we get errors about "Empty closure" and "Expected When Condition", below is JenkinsFile. 

      If I load the above file and then click on edit in blue ocean I get the following errors

      • Expected a when condition @ line 10, column 7.
      • Expected a when condition @ line 18, column 7.
      • Empty when closure, remove the property or add some content. @ line 10, column 7.
      • Empty when closure, remove the property or add some content. @ line 18, column 7.

      pipeline {
        agent any
        
        stages {
          stage('Make Coffee') {
            steps {
              echo 'Making Coffee'
            }
          }
          
          stage('Test Coffee') {
          when {
            changeRequest()
          }
            steps {
              echo 'Test'
            }
          }
          
          stage('Serve Coffee') {
          when {
            buildingTag()
           }
            steps {
              echo 'Drink the Coffee'
            }
          }
        }
        
          options {
          checkoutToSubdirectory('configuration')
              timestamps()
      
        }
      }
      

       

      I generated the When statements using the Declarative pipeline generator from with in Jenkins.

       

      I also tested with the examples from the main jenkins site https://jenkins.io/doc/book/pipeline/syntax/ and when I add these to my jenkinsfile , the blueocean editor complains the same as above.

       

      I am unsure if I am doing something incorrectly of of it a true bug so hopefully someone can look at this and provide some insights.

       

      Also using the online documentation

            Unassigned Unassigned
            aliandro Ali Aly
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: