How to overcome Jenkins pipeline inability to use file parameters
Recently I was trying to implement a Jenkins pipeline which can take a file as a build parameter.
I was planning to use the Jenkins File parameter feature for this purpose.
Jenkins provides a File parameter which allows a build to accept a file, to be submitted by the user when scheduling a new build. The file will be placed inside the workspace at the known location after the check-out/update is done so that your build scripts can use this file.
But unfortunately, implementation was blocked due to the known limitation of the Jenkins side as reported on https://issues.jenkins-ci.org/browse/JENKINS-47333 and https://issues.jenkins-ci.org/browse/JENKINS-27413 tickets.
Basically file parameter doesn't work with Jenkins pipelines mode though it works on normal UI mode.
While searching for a solution, figured out following Groovy code can be used for file upload implementation.
// Get file using input step, will put it in build…