'Jenkins 2.319.1: use custom workspace

I have to create a custom workspace for only one Jenkins build to get files form Git. The standard workspace folder is : /var/lib/jenkins/workspace/test For testing purposes I would like to set the workspace into /tmp/workspace/test I have created the folders and give access.

In the build configuration I have clicked on "Use custom workspace", set my custom folder, apply (see the green popup "Saved") and Save it.

But when I run the build:

  • the custom workspace haven't been used.
  • the build is made in the "default" folder /var/lib/jenkins/workspace/test
  • when I open the configuration of the build the "Use custom workspace" is no more selected.

Is there something specific to do to be able to update the custom workspace for a specific build ?



Solution 1:[1]

This is a known Jenkins issue: https://issues.jenkins.io/browse/JENKINS-67638

The workaround is to go onto your Jenkins machine, find the config.xml for the relevant project, and add the customWorkspace tag manually

<customWorkspace>myWorkspace/</customWorkspace>

Then restart Jenkins (Easiest way is to go to <YourJenkinsUrl>/safeRestart)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1