ac22
ac22

Reputation: 93

How to use Copy to slave plugin

I'm working on a job(say Job A) that has a file as a parameter. However, it triggers another job(say Job B) which restricts its execution on a remote machine(slave04) with a custom workspace /home/jobB/workspace.

Now I tried using ticking Copy files into the job's workspace before building in the Build Environment of Job B and selected custom relative path which is "/" in the option Paths are relative to.

There is the console output of copying process when I print the contents of present working directory (ls -al) of job B which is /home/jobB/workspace the file which is supposed to be copied is not there. Console output is here.

[copy-to-slave] Copying 'var/work/jenkins_workspace/jobA/package.zip', excluding nothing, from 'file:/' on the master to 'file:/home/jobB/workspace/' on 'slave04'.

Was my step correct? What should be the correct input in the field Files to copy? Are filenames(package.zip) and file path(var/work/package.zip) both valid? And what does Paths are relative to mean? In my case, I provided an additional option which is "/" in Manage Jenkins->Configure Settings->Copy to slave, so is it right that every path starting with /whateverpath is already relative to that option?

Copy To Slave Plugin

Upvotes: 2

Views: 10001

Answers (1)

ac22
ac22

Reputation: 93

I have successfully copied uploaded file parameter from master job to slave job workspace.

Procedure that didn't work:

  1. In Manage Jenkins->Configure Settings->Copy to slave I added a Paths are relative to option which is root of the master (/)
  2. In slave job Build Environment configuration, I provided filepath such as var/work/jenkins_workspace/jobA/package.zip in the Files to copy and chose Paths are relative to /(root)
  3. Result: File is not copied.

Procedure that worked:

  1. In Manage Jenkins->Configure Settings->Copy to slave I added a Paths are relative to option which is /var/work/jenkins_workspace/jobA

  2. In slave job Build Environment configuration, I provided filename such as /package.zip in the Files to copy and chose Paths are relative to /var/work/jenkins_workspace/jobA.

  3. Result: File is copied.

So I guess, filepath is not valid in Files to copy field.

Upvotes: 3

Related Questions