Issue
I'm trying to parametrize a Jenkins pipeline with a File type parameter to be used on a docker based agent.
Added a_file parameter, the environment variable is available while executing, but not the file.
Is there any specific steps or way to use file parameters on the Docker-based agent?
An excerpt of the pipeline:
pipeline {
agent { label 'master' }
stages {
stage('Use File parameter') {
agent {
docker {
image 'node:10'
}
}
steps {
sh 'env'
sh 'ls ${a_file}'
...
Solution
That seems to be a known limitation of default File parameters (https://issues.jenkins.io/browse/JENKINS-29289, https://issues.jenkins.io/browse/JENKINS-27413).
The alternative solution is to use Stashed File or base64 File parameter types from File Parameters plugin.
Answered By - Gonzalo Matheu