0

I have an active choice plugin in my job which uses a groovy script to list the folders inside another workspace folder as choices. I was using this with Jenkins single node (no master-slave) and it was working.

Now I have switched to Jenkins master and slave server architecture. Since the workspace is in slave, the choices are not getting listed in the job. Please let me know if there is any way to access the workspace in slave from job in master.

Sree
  • 41
  • 5

1 Answers1

0

One alternative would be simply to not access from the slave. Use the "Archive the artifacts" option to push them from the volatile workspace on the slave to the builds (logs) directory on the master. Then you effectively retrieve them from the master.

Posts here (my similar response), here, here and here provide some insight on usage. Also, official documentation from Jenkins pipeline here.

You can then use Copy Artifacts Plugin to retrieve them from the other job and use them or retrieve directly using your groovy script.

ps: You will probably want to carefully manage the # builds you keep and as suggested in the prior response, consider using the system property jenkins.model.Jenkins.buildsDir to store all the build logs (and artifacts) outside of the jobs config directory.

This response provides an alternative solution using groovy and reading node's workspace, but you are then dependent on the node being up, the workspace not being wiped and a job not to be in progress.

Ian W
  • 4,559
  • 2
  • 18
  • 37
  • Thanks lan, but the master is being used by many others and only slave is allocated for me. So I will not be able to push the files to master. I will check the alternative solution with groovy script – Sree Aug 08 '19 at 10:47
  • What do you mean you "will not be able to push the files to master" ? "Archive the artifacts" option is built-in. – Ian W Aug 18 '19 at 23:03