Upload (per progress bottom bar status) goes through in Jenkins. But don't see option to locate or fetch uploaded file from Jenkins.
Here is simple script with File parameters,
properties(
[
parameters(
[ file(name: "file1.zip", description: 'Choose path to upload file1.zip from local system.'),
file(name: "file2.zip", description: 'Choose path to upload file2.zip from local system.') ]
)
]
)
node {
stage("Fetch Uploaded File") {
sh '''
ls -l file1.zip file2.zip
ls -l ${WORKSPACE}/file1.zip ${WORKSPACE}/file2.zip
'''
}
}
Tried with def input file option per other post, but no luck of reaching uploaded file. Any inputs?
def inputFile = input message: 'Upload file', parameters: [file(name: 'data.ear')]
new hudson.FilePath(new File("$workspace/data.ear")).copyFrom(inputFile)
inputFile.delete()
With scripted full pipeline pasted above, getting below error..
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Fetch Uploaded File)
[Pipeline] sh
[testSh] Running shell script
+ ls -l file1.zip file2.zip
ls: cannot access file1.zip: No such file or directory
ls: cannot access file2.zip: No such file or directory
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 2
Finished: FAILURE