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'
        }
      }
      

          [JENKINS-27413] Handle file parameters

          Jesse Glick created issue -
          Jesse Glick made changes -
          Link New: This issue depends on JENKINS-27295 [ JENKINS-27295 ]
          Jesse Glick made changes -
          Link New: This issue depends on JENKINS-24673 [ JENKINS-24673 ]

          I am not sure I understand the issue's description but we do encounter a problem with workflow and file parameters.

          We observe that the file parameter is not at all taken into account in the workflow parameter:

          • there is no environment variable defined at all concerning the parameter,
          • the file uploaded is not copied into the workflow workspace.

          Which basically makes the file parameter completely useless for a job.
          The same setup works for a standard job.

          Are we are doing something wrong or is it a bug in the workflow plugin as this current issue seems to indicate ?

          Yann Rouillard added a comment - I am not sure I understand the issue's description but we do encounter a problem with workflow and file parameters. We observe that the file parameter is not at all taken into account in the workflow parameter: there is no environment variable defined at all concerning the parameter, the file uploaded is not copied into the workflow workspace. Which basically makes the file parameter completely useless for a job. The same setup works for a standard job. Are we are doing something wrong or is it a bug in the workflow plugin as this current issue seems to indicate ?
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-29289 [ JENKINS-29289 ]

          Jesse Glick added a comment -

          Also need to check how we could send file parameters from a Workflow build, using the build step. Presumably you would want the actual file to come from the contextual workspace.

          Jesse Glick added a comment - Also need to check how we could send file parameters from a Workflow build, using the build step. Presumably you would want the actual file to come from the contextual workspace.

          Is there any way to work around this issue while keeping everything in a pipeline job?

          I have a process where we run a job to pre-process some data, then save the result as an artifact; we then use the Promoted Builds plugin to indicate that the result was OK (after a manual review), and to trigger a second job to load that data using an ETL tool. The second job, then, has to use the Copy Artifact plugin.

          While this works, it feels less direct than I'd like it to be; also, the user has to go to the second job to see the actual result of the ETL load.

          Johan Wärlander added a comment - Is there any way to work around this issue while keeping everything in a pipeline job? I have a process where we run a job to pre-process some data, then save the result as an artifact; we then use the Promoted Builds plugin to indicate that the result was OK (after a manual review), and to trigger a second job to load that data using an ETL tool. The second job, then, has to use the Copy Artifact plugin. While this works, it feels less direct than I'd like it to be; also, the user has to go to the second job to see the actual result of the ETL load.

          Jon Hodgson added a comment -

          I've just run into this issue, in fact I've run into it at an earlier level that the file just doesn't seem to be uploaded at all (you can't view it in the "parameters" page of the build, the file name and link are there, but clicking it gives an error rather than the file contents).

          This is a major issue, because I need to set up try-before-commit functionality.

          Jon Hodgson added a comment - I've just run into this issue, in fact I've run into it at an earlier level that the file just doesn't seem to be uploaded at all (you can't view it in the "parameters" page of the build, the file name and link are there, but clicking it gives an error rather than the file contents). This is a major issue, because I need to set up try-before-commit functionality.
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 161618 ] New: JNJira + In-Review [ 180769 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]

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

              Created:
              Updated:
              Resolved: