Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 for Jenkins Documentation | 1.17.3

# Template workspace

Template workspaces use a predefined template to generate the workspace view. The name of the workspace is generated using the Workspace Name Format field. Use template workspaces when working with Matrix builds.

This type of a workspace cannot be changed, as P4 Server does not allow changing the type of an existing client workspace. As a result, if you attempt to create a new workspace using an existing name but with a different template type, P4 for Jenkins will not create the new workspace. To proceed, delete existing workspace with the same name or choose a new name for the new workspace.

1. In Workspace behaviour, ensure that Template (view generated for each node) is selected.
2. Use Character Set to set the character set used by Jenkins when syncing files from the Perforce P4 Server. This should be set to none unless the workspace is connected to a Unicode enabled P4 Server.
3. In Template workspace: select an existing Perforce workspace that will be used to create or update the Jenkins build workspace. If you are connected to a P4 Server, existing workspaces will be auto suggested as you type.
4. (Optional) Select Pin the workspace to the build host to restrict the workspace to a specific agent. You do not always need to select this option, as including`${NODE_NAME}` in the workspace name already ensures each agent uses a unique workspace.

5. In Workspace name, enter a unique name for the manual workspace. Each Jenkins agent node must use a distinct Perforce workspace. The name is generated using a format string that substitutes predefined variables. You must include at least one variable, but it's recommended to use the following as a minimum:

   jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}

   For more information about variables, see Variable Expansion

   Pipeline:

   - Use a unique workspace name for the Jenkinsfile that will not get reused by the sync steps in the script. A postfix of -script will help to identify the workspace's use and make it unique from code sync steps.

   - Variables in the script for the workspace name must be surrounded by single quotes as shown:

   name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}',

   Using full double quotes " expands the variables early and the script will fail.

Your search for returned results