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

Add support for input steps in views using Jenkins pipelines

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.32.3
      DeliveryPipelinePlugin ver.1.0.0
    • Similar Issues:

      Description

      In delivery pipeline plugin 1.0.0 input steps are not supported for views using Jenkins pipelines, causing the view to crash when the pipeline waits for input. This scenario should be supported in the pipeline view visualization.

      Originally filed issue

      Below is the log after configuring the DPP for workflow.

      Error while serving http://localhost:8081/job/JenkinsPipeline/view/DeliveryPipeline/api/json java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:335) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:175) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:108) at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$3.doDispatch(MetaClass.java:197) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:236) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:236) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:238) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135) at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132) at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132) at jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:86) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249) at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.IOException: Failed to write pipelines at org.kohsuke.stapler.export.Property.safeGetValue(Property.java:151) at org.kohsuke.stapler.export.Property.writeTo(Property.java:126) at org.kohsuke.stapler.export.Model.writeNestedObjectTo(Model.java:227) at org.kohsuke.stapler.export.Model.writeTo(Model.java:198) at org.kohsuke.stapler.ResponseImpl.writeOne(ResponseImpl.java:285) at org.kohsuke.stapler.ResponseImpl.serveExposedBean(ResponseImpl.java:276) at hudson.model.Api.doJson(Api.java:208) ... 82 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.kohsuke.stapler.export.MethodProperty.getValue(MethodProperty.java:66) at org.kohsuke.stapler.export.Property.safeGetValue(Property.java:145) ... 88 more Caused by: java.lang.NullPointerException at se.diabol.jenkins.workflow.WorkflowPipelineView.resolvePipelines(WorkflowPipelineView.java:177) at se.diabol.jenkins.workflow.WorkflowPipelineView.getPipelines(WorkflowPipelineView.java:164) ... 94 more

        Attachments

          Activity

          Hide
          tommysdk Tommy Tynjä added a comment -

          Suresh Kumar can you please provide a reproducing test case (e.g. pipeline and view configurations) for this error?

          Show
          tommysdk Tommy Tynjä added a comment - Suresh Kumar can you please provide a reproducing test case (e.g. pipeline and view configurations) for this error?
          Hide
          pskumar448 Suresh Kumar added a comment -

          Below is my Pipeline script in which I am using Declarative Pipeline. And my View configuration is default settings with the Pipeline project selected. Attaching the Json output of the Runs PipelineProjectRunsJsonOutput.txt

          pipeline {
              agent none
              environment {
                  BUILDNUMBER = 'V1.0-${BUILD_NUMBER}'
              }
              stages {         
                  stage('Pull Code') {
                      agent any
                      steps {
                          checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'DisableRemotePoll'], [$class: 'WipeWorkspace']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '7039d5fb-1884-4e1c-9ea2-db881b2df4f7', url: 'https://gitlab.com/suresh.chr/PetClinic.git']]])
                      }
                  }
                  stage('Compile Code') {
                      agent any
                      steps {
                          sh 'mvn clean compiler:compile'
                      }
                  }
                  stage('Execute UnitTests') {
                      agent any
                      steps {
                          sh 'mvn cobertura:cobertura -Dcobertura.report.format=xml'
                          junit 'target/surefire-reports/*.xml'
                      }
                  }
                  stage('Code Analysis') {
                      agent any
                      steps {
                          script {
                              def sonarqubeScannerHome = tool name: 'SonarRunner', type: 'hudson.plugins.sonar.SonarRunnerInstallation'
                              withSonarQubeEnv('SonarQube') {
                                  sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.projectKey=PetClinic -Dsonar.projectName=PetClinic -Dsonar.projectVersion=$BUILDNUMBER -Dsonar.sources=src -Dsonar.language=java -Dsonar.sourceEncoding=UTF-8 -Dsonar.junit.reportsPath=target/surefire-reports/ -Dsonar.cobertura.reportPath=target/site/cobertura/coverage.xml"
                              }
                          }
                      }
                  }
                  stage('Package') {
                      agent any
                      steps {
                          sh 'mvn package -DskipTests=true'
                      }
                  }
                  stage('Upload to Nexus') {
                      agent any
                      steps {
                          nexusArtifactUploader artifacts: [[artifactId: 'PetClinic', classifier: '', file: 'target/petclinic.war', type: 'war']], credentialsId: '7b46df56-f07e-4e53-b3a3-aa279d324ad4', groupId: 'PetClinic', nexusUrl: '192.168.56.1:8082', nexusVersion: 'nexus3', protocol: 'http', repository: 'PetClinic', version: env.BUILDNUMBER
                      }
                  }
                  stage('Approval') {
                      steps {
                          input message: 'Deploy to Dev Env', ok: 'Approve'
                      }
                  }
                  stage('Deployment') {
                      agent any
                      steps {
                          deploypublisher adapters: [tomcat7x(password: 'D4eIGcBCvcCT', url: 'http://192.168.56.1:8888', userName: 'admin')], contextPath: 'PetClinic', onFailure: false, war: 'target/petclinic.war'
                      }
                  }
              }
          }
          

          I am also trying at my end to find the cause.

          Show
          pskumar448 Suresh Kumar added a comment - Below is my Pipeline script in which I am using Declarative Pipeline. And my View configuration is default settings with the Pipeline project selected. Attaching the Json output of the Runs PipelineProjectRunsJsonOutput.txt pipeline {     agent none     environment {         BUILDNUMBER = 'V1.0-${BUILD_NUMBER}'     }     stages {                  stage( 'Pull Code' ) {             agent any             steps {                 checkout([$class: 'GitSCM' , branches: [[name: '*/master' ]], doGenerateSubmoduleConfigurations: false , extensions: [[$class: 'DisableRemotePoll' ], [$class: 'WipeWorkspace' ]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '7039d5fb-1884-4e1c-9ea2-db881b2df4f7' , url: 'https: //gitlab.com/suresh.chr/PetClinic.git' ]]])             }         }         stage( 'Compile Code' ) {             agent any             steps {                 sh 'mvn clean compiler:compile'             }         }         stage( 'Execute UnitTests' ) {             agent any             steps {                 sh 'mvn cobertura:cobertura -Dcobertura.report.format=xml'                 junit 'target/surefire-reports/*.xml'             }         }         stage( 'Code Analysis' ) {             agent any             steps {                 script {                     def sonarqubeScannerHome = tool name: 'SonarRunner' , type: 'hudson.plugins.sonar.SonarRunnerInstallation'                     withSonarQubeEnv( 'SonarQube' ) {                         sh "${sonarqubeScannerHome}/bin/sonar-scanner -Dsonar.projectKey=PetClinic -Dsonar.projectName=PetClinic -Dsonar.projectVersion=$BUILDNUMBER -Dsonar.sources=src -Dsonar.language=java -Dsonar.sourceEncoding=UTF-8 -Dsonar.junit.reportsPath=target/surefire-reports/ -Dsonar.cobertura.reportPath=target/site/cobertura/coverage.xml"                     }                 }             }         }         stage( 'Package' ) {             agent any             steps {                 sh 'mvn package -DskipTests= true '             }         }         stage( 'Upload to Nexus' ) {             agent any             steps {                 nexusArtifactUploader artifacts: [[artifactId: 'PetClinic' , classifier: '', file: ' target/petclinic.war ', type: ' war ']], credentialsId: ' 7b46df56-f07e-4e53-b3a3-aa279d324ad4 ', groupId: ' PetClinic ', nexusUrl: ' 192.168.56.1:8082 ', nexusVersion: ' nexus3 ', protocol: ' http ', repository: ' PetClinic', version: env.BUILDNUMBER             }         }         stage( 'Approval' ) {             steps {                 input message: 'Deploy to Dev Env' , ok: 'Approve'             }         }         stage( 'Deployment' ) {             agent any             steps {                 deploypublisher adapters: [tomcat7x(password: 'D4eIGcBCvcCT' , url: 'http: //192.168.56.1:8888' , userName: 'admin' )], contextPath: 'PetClinic' , onFailure: false , war: 'target/petclinic.war'             }         }     } } I am also trying at my end to find the cause.
          Hide
          pskumar448 Suresh Kumar added a comment -

          Figured the cause of the issue, why it is throwing NPE. If we have a 'input' step and build is waiting for action approve or reject, this time we are getting this error.

          Show
          pskumar448 Suresh Kumar added a comment - Figured the cause of the issue, why it is throwing NPE. If we have a 'input' step and build is waiting for action approve or reject, this time we are getting this error.
          Hide
          tommysdk Tommy Tynjä added a comment -

          Suresh Kumar I see. Yes, that is a use case that is currently not supported. It would be nice to give an error message instead of an NPE in this case (maybe like this https://github.com/Diabol/delivery-pipeline-plugin/compare/master...tommysdk:JENKINS-43525 ?) before such support is implemented.

          It would be great to support the input step, e.g. in the same way we traditionally plot the manual trigger, but with an additional popup where you can specify the input.

          Show
          tommysdk Tommy Tynjä added a comment - Suresh Kumar I see. Yes, that is a use case that is currently not supported. It would be nice to give an error message instead of an NPE in this case (maybe like this https://github.com/Diabol/delivery-pipeline-plugin/compare/master...tommysdk:JENKINS-43525 ?) before such support is implemented. It would be great to support the input step, e.g. in the same way we traditionally plot the manual trigger, but with an additional popup where you can specify the input.
          Hide
          tommysdk Tommy Tynjä added a comment -

          Suggesting that we rewrite this issue as support for input step.

          A simple pipeline configuration example with input step:
          node {
              stage 'Build'
              sh 'sleep 1'

              stage 'Test'
              sh 'sleep 1'

              stage 'Deploy'
              input message: 'Deploy?', ok: 'Approve'
              sh 'sleep 1'
          }

          Show
          tommysdk Tommy Tynjä added a comment - Suggesting that we rewrite this issue as support for input step. A simple pipeline configuration example with input step: node {     stage 'Build'     sh 'sleep 1'     stage 'Test'     sh 'sleep 1'     stage 'Deploy'     input message: 'Deploy?', ok: 'Approve'     sh 'sleep 1' }
          Hide
          tommysdk Tommy Tynjä added a comment -

          Visualization first draft: https://github.com/tommysdk/delivery-pipeline-plugin/tree/JENKINS-43525-input-step-support (not taking into account actual input form display)

          Show
          tommysdk Tommy Tynjä added a comment - Visualization first draft: https://github.com/tommysdk/delivery-pipeline-plugin/tree/JENKINS-43525-input-step-support (not taking into account actual input form display)
          Hide
          tommysdk Tommy Tynjä added a comment -

          Pull request merged: https://github.com/Diabol/delivery-pipeline-plugin/pull/244

          Feature will be part of next release.

          Show
          tommysdk Tommy Tynjä added a comment - Pull request merged: https://github.com/Diabol/delivery-pipeline-plugin/pull/244 Feature will be part of next release.
          Hide
          tommysdk Tommy Tynjä added a comment -

          Released in Delivery Pipeline plugin 1.0.2.

          Show
          tommysdk Tommy Tynjä added a comment - Released in Delivery Pipeline plugin 1.0.2.

            People

            Assignee:
            tommysdk Tommy Tynjä
            Reporter:
            pskumar448 Suresh Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: