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

Handle file parameters

XMLWordPrintable

      JENKINS-27295 discusses getting values from various kinds of parameters. Handling FileParameterValue is another matter. buildEnvironment (what is called today) is useless since it gives only a file name. createBuildWrapper is the way this works in a freestyle project, but this cannot work in a workflow; even if it were to return a SimpleBuildWrapper (JENKINS-24673) it is not clear where that would be called, since we can only use it from a workspace. getValue as currently implemented is useless since a FileItem does not have whitelisted methods, and anyway we would not want the flow itself to be copying streams to the workspace; this needs to be done by infrastructure. The only way forward I can see at the moment is for getValue to return a SimpleBuildWrapper, so that your flow could read

      node {
        wrap([$delegate: parameters.myFileParam]) {
          sh 'cat myFileParam'
        }
      }
      

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            111 Vote for this issue
            Watchers:
            119 Start watching this issue

              Created:
              Updated:
              Resolved: