How do I change the workspace to get created on a different disk?
How do I change the workspace to get created on a different disk?
/path/to/workspace/${configuration.pathName}
${groovy:
int buildsDir = configuration.getPathName().indexOf( "builds", 0 )
int pathStart = configuration.getPathName().indexOf( "/", buildsDir )
if ((buildsDir >= 0) && (pathStart >= 0) && node.hasAttribute( "BUILDDRIVE" )) {
node.getAttribute( "BUILDDRIVE" ) + "/" + configuration.getPathName().substring( pathStart )
\} else {
system.getWorkspaceDir().getAbsolutePath() + "/" + configuration.getPathName()
\}
}
If BUILDDRIVE is not defined on the system, it uses the default path inside of the QuickBuild install directory.
If BUILDDRIVE is defined, it puts all work spaces for configurations under the 'root/builds' configuration on BUILDDRIVE.
So, for example, configuration root/builds/Product/Branch/Nightly will be built in %BUILDDRIVE%\Product\Branch\Nightly (or, on unix, $BUILDDRIVE/Product/Branch/Nightly).
Configurations not under root/builds/... will also go in the default location.
This also works if your builds directory is called 'test-builds' or 'builds-v1', or 'product_builds'.
The "/path/to/workspace" that I give, gets created within the QB install directory.
i.e. If I have my QB installed on F drive of my server, the default workspace (without making the root workspace advance setting) looks like "F:\Program Files\quickbuild-4.0.12\workspace\" and the code gets checked out in this location.
If I make the workspace advance setting on root (as you mentioned), the code gets checked out to "F:\Program Files\quickbuild-4.0.12\workspace\path\to\workspace\..."
I will need the code to be checked on a different drive of the server, say, "G:\workspace\..." even though QB is installed on F: drive. However this location cannot be hardcoded at root, as all the build agents need not have G drive.
Please let me know.
${node.hasAttribute("workspaceRoot")?node.getAttribute("workspaceRoot"): system.workspaceDir.absolutePath}/${configuration.pathName}
This script tells QB to check if a workspaceRoot user attribute is defined for a node, if yes, then use that as workspace root, otherwise, use the default workspace root under QB installation directory.
Then for node you'd like to specify a different workspace root, just define the user attribute "workspaceRoot" in grid tab, with value for instance:
F:\workspace
As you suggested, I'd placed the given script in the root configuration and added node user attribute "worskpaceRoot" with the value "G:\TSCM_V3\workspace".
While creating the workspace, QB rightly picks up the "workspaceRoot" value. However, it still tries to create it under default workspace. Also, don't know why it tries to create it recursively.
Please find the error message:
Unable to create directory: F:\Program Files\quickbuild-4.0.12\workspace\"G:\TSCM_V3\workspace"\TMS\TIP\TIP_Web\"G:\TSCM_V3\workspace"\TMS\TIP\TIP_Web\"G:\TSCM_V3\workspace"\TMS\TIP\TIP_Web
Whatever script or value, we give in the root workspace configuration, it tries to create the same under default workspace and add the configuration.pathName to it.
I've sent you the database back up.
TMS is the root configuration in which workspace location setting has been edited. The build on the configuration TIP/TIP_Web was tried and it failed. The node VCTMSDASV25 is the server node in which the UserAttribute "workspaceRoot" has been defined.