1

Given the following simple pipeline

properties([
    parameters([
    fileParam( description:'', name: 'MYFILE')
    ])
])


node('master'){
    stage('Clone One') {
        echo "${MYFILE}"
        echo params.MYFILE
    }
}

It's a simple example, it does show the build as a parametrized build, it ask's for the input file, however, It does not list the file on params object value.

The first echo, returns the name of the file it self, and the second prints out NULL.

Problem, how can I access the actual uploaded file? The upload path? The temporary file name?

StephenKing
  • 36,187
  • 11
  • 83
  • 112
gutomaia
  • 91
  • 1
  • 7
  • I saw this, although, they are not using the "fileParam" parameter. I'm looking for a more cleaner solution using it. Also, as said in that solution: "I know the solution is not that beautiful because the pipeline gets interrupted for the upload but it works.". I don't want that interrupt behavior. The way described above, the file param is asked right upfront along with other build parameters. – gutomaia Aug 13 '18 at 21:32
  • Writing `parameters([fileParam(...)])` and `parameters([file(...]})` is the same thing, they are short hand for `parameters[[$class: 'FileParameterDefinition', ...]]` (due to symbol definition here; https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/FileParameterDefinition.java#L60). Please also not the first answer in linked issue, this is an known problem and there is an open issue, especially note this comment in the issue; https://issues.jenkins-ci.org/browse/JENKINS-27413?focusedCommentId=313706#comment-313706 – Jon S Aug 14 '18 at 05:07

0 Answers0