How to use Jenkins file parameter in Pipelines

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use Jenkins file parameter in Pipelines

Shifa Shaikh

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 ?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9c8c52c1-ce32-425b-8c06-5fb2fdf7de51n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to use Jenkins file parameter in Pipelines

Geoffroy J
Hello

i don't think File Parameters are supported by Jenkins Pipeline
See https://issues.jenkins.io/browse/JENKINS-27413

Regards

On Wednesday, 3 February 2021 at 07:23:51 UTC+1 [hidden email] wrote:

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 ?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6c6eca43-e676-4cb7-8161-61fb6fd4efd1n%40googlegroups.com.