Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you copy a project from Jenkins into a folder?

Tags:

jenkins

We have the Jenkins folder plugin. When a new folder is created, and 'Add an item' is selected, none of the projects from the containing Jenkins database are available to be copied in the 'copy from' selection. What's the easiest way to copy an existing Jenkins project into a new folder?

like image 200
dolphus333 Avatar asked Nov 04 '25 20:11

dolphus333


2 Answers

You need to specify the absolute path.

For example if you create folder

Util

And inside Util you want to copy job "FooJob" from the base level in "copy from" specify

/FooJob

Or of FooJob is inside folder Bar specify

/Bar/FooJob

The answer given by krtrego (use absolute paths) is correct -- but: you can also copy the job on filesystem level, which is preferable in many cases. That is, on Linux, do

cp -ar $JENKINS_HOME/jobs/jobXYZ $JENKINS_HOME/jobs/folderABC/jobs

Shutdown Jenkins beforehand and start it afterwards (or do not shutdown, and just "reload configuration from disk" afterwards).

Depending on the definition of "easy", this might be the best choice, since

  • If you're copying many jobs, then this is only way that jobs won't start before you completed moving all of them ("Folder copy" on GUI-level does not work in "quiet-down" mode).
  • The Folder copy operation sometimes takes ages (literally) for certain jobs.

Tagline: for anything but the most simple tasks, it will be good to avoid Folder Move/Copy.

like image 32
Alex O Avatar answered Nov 07 '25 16:11

Alex O



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!