How to use Jenkins file parameter in Pipelines

42 views
Skip to first unread message

shif...@gmail.com

unread,
Feb 3, 2021, 1:23:51 AM2/3/21
to Jenkins Users

My Jenkins pipeline runs on the Slave using agent { node { label 'slave_node1' } }.

I use Jenkins file parameter named uploaded_file and upload a file called hello.pdf

My pipeline contains the following code

stage('Precheck')
 { steps
 { 
 sh "echo ${WORKSPACE}"
 sh "echo ${uploaded_file}
 sh "ls -ltr ${WORKSPACE}/*"

Output:

/web/jenkins/workspace/MYCOPY hello.pdf ls: cannot access /web/jenkins/workspace/MYCOPY/* No such file or directory

As you can see no files were found on the slave WORKSPACE.

Can you let me understand if I'm checking for the uploaded file in the correct location i.e under WORKSPACE directory?

How can I get the file uploaded to the slave's WORKSPACE?

I'm on jenkins version 2.249.1

Can I get this to work at least on the latest version of Jenkins ?

geoffroy...@gmail.com

unread,
Feb 3, 2021, 11:38:28 AM2/3/21
to Jenkins Users
Hello

i don't think File Parameters are supported by Jenkins Pipeline

Regards
Reply all
Reply to author
Forward
0 new messages