In course of uploading binary file with few attempts per file parameter uploaded file in Jenkins is missing & Fetching binary or zipped uploaded files in Jenkins - Windows cannot open the folder . The Compressed(zipped) Folder is invalid noticed, writeFile
Groovy used as part of Jnekins pipeline is corrupting content of file along with its size - worried more from Binary file perspective.
Per the documentation, https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#writefile-write-file-to-workspace , it's mentioned to support base64
encoding for binary data for writing files, but looks like it's bug as written file is with wrong size (exceeds..) & corrupt, as one can't open zip or binary file as highlighted in post linked above.
writeFile: Write file to workspace Write the given content to a named file in the current directory. file Type: String text Type: String encoding (optional) The target encoding for the file. If left blank, the platform default encoding will be used. If the text is a Base64-encoded string, the decoded binary data can be written to the file by specifying "Base64" as the encoding. Type: String
Any work-around is present or is there a way to raise bug-fix request?
Here is line of code which looks to be causing problem from groovy Jenkins pipeline script
// Read contents and write to workspace
writeFile(file: filename, encoding: 'Base64', text: filedata.read().getBytes().encodeBase64().toString())