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

Unable to edit pipeline in blueocean when Jenkinsfile contains "withSonarQubeEnv"

      Everything is fine until I switch to edit mode. Then, OceanBlue layout is displayed but the stages are not.

      In chrome console, this error message appears :

      blueocean.js:58253 Unhandled Rejection: "Error: No parameters for: withSonarQubeEnv\n at convertStepFromJson (https://app.jaguards.com:4433/adjuncts/e896cb23/org/jenkins/ui/jsmodules/blueocean-pipeline-editor/jenkins-js-extension.js:63287:27)\n at convertStageFromJson (https://app.jaguards.com:4433/adjuncts/e896cb23/org/jenkins/ui/jsmodules/blueocean-pipeline-editor/jenkins-js-extension.js:63239:28)\n at convertJsonToInternalModel (https://app.jaguards.com:4433/adjuncts/e896cb23/org/jenkins/ui/jsmodules/blueocean-pipeline-editor/jenkins-js-extension.js:63195:28)\n at https://app.jaguards.com:4433/adjuncts/e896cb23/org/jenkins/ui/jsmodules/blueocean-pipeline-editor/jenkins-js-extension.js:57251:96\n at https://app.jaguards.com:4433/adjuncts/e896cb23/org/jenkins/ui/jsmodules/blueocean-pipeline-editor/jenkins-js-extension.js:63513:13\n at https://app.jaguards.com:4433/adjuncts/e896cb23/org/jenkins/ui/jsmodules/blueocean-pipeline-editor/jenkins-js-extension.js:64335:17\n at <anonymous>"
      logUnhandledPromiseRejection @ blueocean.js:58253

      In case it helps, this is the Jenkinsfile : 

      pipeline {
        agent any
        stages {
          stage('Server build (Java 8)') {
            agent {
              docker {
                image 'openjdk:8'
                args '-v /srv/docker/jenkins-containers/cache/gradle-java8:/root/.gradle'
              }
            }
            steps {
              sh 'cd server && ./gradlew clean && ./gradlew build'
            }
          }
          stage('Client build') {
            agent {
              docker {
                image 'node:9'
                args '--network jenkinscontainers_default --link sonarqube -v /srv/docker/jenkins-containers/cache/npm-node9:/root/.npm'
              }
            }
            steps {
              withSonarQubeEnv('sonar') {
                sh 'cd ./client && npm install'
              }
            }
          }
          stage('Server SonarQube analysis') {
            agent {
              docker {
                image 'openjdk:8'
                args '--network jenkinscontainers_default --link sonarqube -v /srv/docker/jenkins-containers/cache/gradle-java8:/root/.gradle'
              }
            }
            steps {
              withSonarQubeEnv('sonar') {
                sh 'cd ./server && ./gradlew --info sonarqube'
              }
            }
          }
          stage('Server SonarQube QG') {
            agent {
              docker {
                image 'openjdk:8'
                args '--network jenkinscontainers_default --link sonarqube -v /srv/docker/jenkins-containers/cache/gradle-java8:/root/.gradle'
              }
            }
            steps {
              timeout(time: 1, unit: 'HOURS') {
                waitForQualityGate()
              }
            }
          }
          stage('Client SonarQube analysis') {
            agent {
              docker {
                image 'node:9'
                args '--network jenkinscontainers_default --link sonarqube -v /srv/docker/jenkins-containers/cache/npm-node9:/root/.npm'
              }
            }
            steps {
              withSonarQubeEnv('sonar') {
                sh 'cd ./client && npm install && npm run-script sonar-scanner'
              }
            }
          }
          stage('Client SonarQube QG') {
            agent {
              docker {
                image 'node:9'
                args '--network jenkinscontainers_default --link sonarqube -v /srv/docker/jenkins-containers/cache/npm-node9:/root/.npm'
              }
            }
            steps {
              timeout(time: 1, unit: 'HOURS') {
                waitForQualityGate()
              }
            }
          }
        }
      }
       

       

       

          [JENKINS-50148] Unable to edit pipeline in blueocean when Jenkinsfile contains "withSonarQubeEnv"

          Andrew Bayer added a comment -

          The problem is that withSonarQubeEnv isn't actually a Step class, it's a SimpleBuildWrapper, which gets invoked behind the scenes via CoreWrapperStep (aka wrap). The editor's PipelineMetadataService#doPipelineStepMetadata() method looks for Builder and Publisher metastep candidates (i.e., SimpleBuildStep implementations), but not SimpleBuildWrapper. Gonna see what I can do here.

          Andrew Bayer added a comment - The problem is that withSonarQubeEnv isn't actually a Step class, it's a SimpleBuildWrapper , which gets invoked behind the scenes via CoreWrapperStep (aka wrap ). The editor's PipelineMetadataService#doPipelineStepMetadata() method looks for Builder and Publisher metastep candidates (i.e., SimpleBuildStep implementations), but not SimpleBuildWrapper . Gonna see what I can do here.

          Andrew Bayer added a comment -

          I think I have a functional PR up at https://github.com/jenkinsci/blueocean-plugin/pull/1786

          Andrew Bayer added a comment - I think I have a functional PR up at https://github.com/jenkinsci/blueocean-plugin/pull/1786

          Keith Zantow added a comment -

          There's some front end stuff to be fixed, here. I almost have a working fix, will update this ticket shortly when ready

          Keith Zantow added a comment - There's some front end stuff to be fixed, here. I almost have a working fix, will update this ticket shortly when ready

            abayer Andrew Bayer
            romlly Romain Ciaccafava
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: