Perforce: Publish assets

Jenkins can automatically shelve or submit build assets to a Perforce Helix Core Server. For example, you could use this function to publish a PDF version of the release document to the Helix Core Server you use for the build or even a different Helix Core Server if required.

Perforce Credentials

Select the credentials for the project from the Perforce credentials dropdown.

Workspace behavior

Use a unique Perforce Workspace to Publish the assets. The Client View should be as narrow as possible, ideally only mapping the assets that need to be published. Adding a postfix of -publish to the Workspace will help to identify its purpose.

Note

Many of the workspace fields can include environment variables to help define their value. We recommend that variables are used in the Workspace name to enable you to identify builds. For more information about environment variables, see Variable Expansion.

Perforce workspaces support the following behaviors:

  • Manual (custom view): Manually define the workspace view, and sync options. Creates the workspace if it does not already exist or updates the workspace spec by setting the various options if it already exists. Jenkins will fill out the workspace root and may override the clobber option. For details about manually configuring your workspace, see Manual workspace.
  • Static (static view, master only): Uses a predefined workspace, the workspace must have a valid view and must already exist. The plugin user must either own the workspace or the spec must be unlocked allowing the plugin user to make edits. The workspace view remains static, but Jenkins will update other fields such as the workspace root, and clobber option. For details about using a static predefined workspace, see Static workspace.
  • Template (view generated for each node): Uses a specified template to generate the workspace view. The name of the workspace is generated using the Workspace Name Format field. This makes it an ideal choice for Matrix builds. For details about using a template to generate the workspace, see Template workspace.
  • Streams (view generated by Perforce for each node): Uses a specified stream to generate the workspace view. The name of the workspace is generated using the Workspace Name Format field. This makes it an ideal choice for Matrix builds. For details about using a stream to generate the workspace, see Streams workspace.
  • Spec File (load workspace spec from file in Perforce): Loads the workspace configuration from a depot file containing a client workspace spec. This is the same output as p4 client -o and the Spec depot .p4s format. The name of the Workspace must match the name of the client workspace spec. For details about using a spec file for your workspace, see Spec File workspace.

Publish Options

Now complete the configuration by selecting one of the following change types:

Shelve Change

Shelve Assets

  1. Publish options: Select Shelve change from the dropdown list.
  2. Description: The change description used to shelve the assets to the Perforce Helix Core Server. ${VAR} variables are expanded based on the system environment. For more information about environment variables, see Variable Expansion.
  3. Options there are a number of options that can be set to configure client behavior:
    • Only publish on build success: The assets will only be shelved when the build is successful.
    • Propagate deletes: Select to enable files to be deleted when the asset is published.
    • Revert opened file list: Reverts open files in the pending changelist, but leaves the content in the workspace unchanged. Equivalent to p4 revert -k.

Submit Change

Submit Assets

  1. Publish options: Select Submit change from the dropdown list.
  2. Description: The change description used to submit the assets to the Perforce Helix Core Server. ${VAR} variables are expanded based on the system environment. For more information about environment variables, see Variable Expansion.
  3. Options there are a number of options that can be set to configure client behavior:
    • Only publish on build success: The assets will only be shelved when the build is successful.
    • Propagate deletes: Select to enable files to be deleted when the asset is published.
    • Reopened files: Submitted files are reopened, allowing subsequent modification.