Hello,

       

      I have created a pipleine job with file parameter. When I try to upload file through curl the file is not getting uploaded. When checked in build page parameters clicking on file parameter name it is giving below error. The same command runs for freestyle job and working good,

       

      java.lang.NullPointerException at hudson.model.FileParameterValue.doDynamic(FileParameterValue.java:205) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117) at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:397) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)

       

      Thanks.

          [JENKINS-51245] file parameter issue in jenkins pipeline

          Seg Fault added a comment -

          i have the same issue here, because there is no file in the workspace as in a freestyle project.

          Jenkinsfile:

          pipeline {
              agent any
              parameters {
                file description: 'desc', name: 'fancyfile'
              }
              stages {
                  stage('seefile') {
                      steps {
                          echo "what $fancyfile"
                          sh "pwd"
                          sh "ls -lah"
                          sh "cat fancyfile"
                      }
                  }
              }
          }

          Output:

          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (seefile)
          [Pipeline] echo
          what UploadedFileName
          [Pipeline] sh
          [blubb] Running shell script
          + pwd
          /var/jenkins_home/workspace/jobname
          [Pipeline] sh
          [blubb] Running shell script
          + ls -lah
          total 8.0K
          drwxr-xr-x 2 jenkins jenkins 4.0K May 18 10:23 .
          drwxr-xr-x 4 jenkins jenkins 4.0K May 18 10:23 ..
          [Pipeline] sh
          [blubb] Running shell script
          + cat fancyfile
          cat: fancyfile: No such file or directory
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE

          Seg Fault added a comment - i have the same issue here, because there is no file in the workspace as in a freestyle project. Jenkinsfile: pipeline {     agent any     parameters {       file description: 'desc', name: 'fancyfile'     }     stages {         stage('seefile') {             steps {                 echo "what $fancyfile"                 sh "pwd"                 sh "ls -lah"                 sh "cat fancyfile"             }         }     } } Output: [Pipeline] { [Pipeline] stage [Pipeline] { (seefile) [Pipeline] echo what UploadedFileName [Pipeline] sh [blubb] Running shell script + pwd /var/jenkins_home/workspace/jobname [Pipeline] sh [blubb] Running shell script + ls -lah total 8.0K drwxr-xr-x 2 jenkins jenkins 4.0K May 18 10:23 . drwxr-xr-x 4 jenkins jenkins 4.0K May 18 10:23 .. [Pipeline] sh [blubb] Running shell script + cat fancyfile cat: fancyfile: No such file or directory [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code 1 Finished: FAILURE

          Seg Fault added a comment -

          Same issue here... the files does not exists in the job directory, as in a freestyle project.

          Jenkinsfile:

          pipeline {
          agent any
          parameters {
          file description: 'desc', name: 'fancyfile'
          }
          stages {
          stage('seefile') {
          steps {
          echo "what $fancyfile"
          sh "pwd"
          sh "ls -lah"
          sh "cat fancyfile"
          }
          }
          }
          }

          Output:

          [Pipeline] {
          [Pipeline] stage
          [Pipeline] { (seefile)
          [Pipeline] echo
          what UploadedFileName
          [Pipeline] sh
          [blubb] Running shell script
          + pwd
          /var/jenkins_home/workspace/jobname
          [Pipeline] sh
          [blubb] Running shell script
          + ls -lah
          total 8.0K
          drwxr-xr-x 2 jenkins jenkins 4.0K May 18 10:23 .
          drwxr-xr-x 4 jenkins jenkins 4.0K May 18 10:23 ..
          [Pipeline] sh
          [blubb] Running shell script
          + cat fancyfile
          cat: fancyfile: No such file or directory
          [Pipeline] }
          [Pipeline] // stage
          [Pipeline] }
          [Pipeline] // node
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE

          Seg Fault added a comment - Same issue here... the files does not exists in the job directory, as in a freestyle project. Jenkinsfile: pipeline { agent any parameters { file description: 'desc', name: 'fancyfile' } stages { stage('seefile') { steps { echo "what $fancyfile" sh "pwd" sh "ls -lah" sh "cat fancyfile" } } } } Output: [Pipeline] { [Pipeline] stage [Pipeline] { (seefile) [Pipeline] echo what UploadedFileName [Pipeline] sh [blubb] Running shell script + pwd /var/jenkins_home/workspace/jobname [Pipeline] sh [blubb] Running shell script + ls -lah total 8.0K drwxr-xr-x 2 jenkins jenkins 4.0K May 18 10:23 . drwxr-xr-x 4 jenkins jenkins 4.0K May 18 10:23 .. [Pipeline] sh [blubb] Running shell script + cat fancyfile cat: fancyfile: No such file or directory [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code 1 Finished: FAILURE

            Unassigned Unassigned
            kj9361 kailash joshi
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: