- Stop Jenkins
- On the File system move the directories where you want them to go
- Start Jenkins again
- You submit a move request to Jenkins for the item you want to move.
- The move request goes into the Jenkins queue.
- When there are move requests on the Jenkins queue, a special temporary node is added to Jenkins to handle the move request. This node will only process move requests and can only handle one move request at a time, thereby removing race conditions.
- When a move request is being processed:
- Any of the jobs within the item are temporarily disabled to ensure that no new builds are started
- Any in-progress builds block the move until they complete
- The file system move is made (this will be retried a number of times to handle the case of Windows file locking preventing the move)
- The Jenkins item’s parent is adjusted so that the configuration does not need to be reloaded
- Once all move requests have been processed, the special temporary node is removed.
All this is available now if you upgrade to version 3.2 of the CloudBees Folders plugin. And if you haven’t got the CloudBees Folders plugin, it is available for free (registration required) if you install the CloudBees Free Enterprise Plugins.