Open RobinFauvel opened 2 years ago
I do not think there should be any difference. base64File
and stashedFile
would differ only in how the downstream build stores the parameter, not how it accepts it.
Is there any update here? I am facing the same issue. I have a job that takes a stashedFile and a string as parameters, but I can't figure out how to call that from an upstream pipeline?
File build = runSomeOtherMethod();
build job: 'build-server-apk', parameters: [
stashedFile(name: 'FILE', base64: Base64.encoder.encodeToString(build.bytes)),
string(name: 'BUILD_CONFIG', value: "${buildConfig}")
]
This results in an error like...
hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: java.io.File.call() is applicable for argument types: (java.util.LinkedHashMap) values: [[job:build-server-apk, parameters:[@stashedFile(name=FILE,value=/jenkins_data/jenkins_home/jobs/TWC Flagship App/jobs/Apps-Upload-Build-To-BrowserStack-With-Espresso/workspace/sdui-main-104.apk), ...]]]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), list()
To be clear this is a larger file, hence the use of a stashed file. about 150MB
Edit: that output was actually from a second run passing the java.nio.File object directly. Encoding to Base64 string did not work either for reference.
Is there any update here?
Sorry, no, I have not found time to write a test for this scenario and investigate.
this is a larger file, hence the use of a stashed file. about 150MB
FYI performance is likely to be poor if you are trying to pass around large files between builds using the build
step. https://github.com/jenkinsci/file-parameters-plugin#usage-with-build is intended for small files only (for which stashing would be overkill anyway). Efficiently transferring large files would require a more complicated design TBD. It is best to handle large files using an external artifact repository or blob store and have Jenkins just pass around URLs or other handles, though I suppose if you had such a system configured and available you would not need this plugin to begin with!
Thank you, appreciate the response. Yeah I wish I had an artifact repo setup for this haha. Though your phrasing does give me an alternative idea that may be workable. We do a fetch on the file in the parent pipeline. My thought was to pass the file along, but that's how I ended up here....
It's not ideal, but I could just pass the name of the file into the child job and rerun the fetch a second time. Not the end of the world I suppose.
If you can fetch the file from somewhere else, that is probably better, as it reduces the disk consumption and I/O pressure on the Jenkins controller (assuming you run builds on agents). Stashed file parameters are more intended for cases where largish files must be submitted to the controller, whether through a browser upload by a human, or REST or CLI action from some external tool, and would not easily be available for download.
Describe your use-case which is not covered by existing documentation.
The documentation clearly indicates how to pass a
base64File
parameter to a downstream Job via thebuild
step. This is not the case for a parameter of typestashedFile
. In particular, how to create a file of typeorg.apache.commons.fileupload.FileItem
to give to thefile
argument? Thank youReference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.
No response