Jenkins environment variables in project settings, how

Jenkins

In a Jenkins project you can set an arbitrary work path. I'd like to specify one below the standard project output path (e.g. workspace/my-project). However, for that I'd need to know the default path or at least the project name. There are a number of environment variables available (like $WORKSPACE), but I cannot use them in the project settings.

What is the correct way instead?

Best Answer

From Advanced Project Options, check Use custom workspace, and enter "./my-project" (without quotes)

Jenkins will accept relative paths in this field. The help there states:

If this path is relative, it's resolved against the "remote FS root" directory of the slave, or $JENKINS_HOME on the master.