Configure P4 Server extensions

P4 Server provides extensions to customize server operations or invoke additional processing for specific versioning operations. Perforce TeamHub extensions notify TeamHub about activity on the P4 Server. When extensions are configured, any pushes to graph depots or any submits to stream depots are visible as events in the TeamHub Activity view.

You can easily install, view the status of, and remove extensions using the TeamHub admin UI. Extensions are installed on the P4 Server that TeamHub is configured to connect to.

Configuring extensions requires that you already have an administrator bot account. For more information on setting up an administrator bot account, see Step 1: Create a Perforce TeamHub company administrator bot.

Extensions require P4 Server 2019.2 or later. If you are using an earlier version of P4 Server, you must use triggers and not extensions.

Step 1: Create a Perforce TeamHub company administrator bot

Perform the following steps to create a new bot.

  1. To ensure you are at the company scope level, click the company name or logo in the top left corner.
  2. In the Main menu pane, click Bots.

  3. In the Bots view, click the Plus button Add icon.

    The Create bot pane opens.

  4. Provide the following information:

    • Short name: Username for the bot. You cannot modify the short name after creating a bot.

    • Password: Password for the bot. Leaving the field empty generates a random password. Bot users can view the password in the bot settings form.

    • Company admin bot: Select to create a company admin bot instead of a normal bot.

    • Private bot: Select to hide bot from other users.

  5. Click Create.

    After creating a bot, you can manage its settings (excluding Company admin bot status) from the bot settings form or the Bot > Users view. To access the settings, click the Gear button Gear icon next to the bot name in the Bots tab.

    You can also delete the bot using the settings form.

Step 2: Configure the Perforce TeamHub administrator bot

Select the account key for the company administrator bot that is used by P4 Server to perform authenticated calls.

  1. Log in to the TeamHub admin UI.

  2. Click P4 Extensions.

    The Configure P4 Server Extensions page opens.

  3. Under TeamHub properties, click Account Key.

    A dropdown opens.

  4. Select a bot.

  5. Click Save.

    The bot is saved to the account key.

Step 3: Set the hostname

Set the hostname for the TeamHub instance.

  1. Log in to the TeamHub admin UI.

  2. Click Preferences.

  3. In Configure instance under Hostname, enter the URL the TeamHub instance users access.

  4. Click Save preferences.

    The hostname is set.

Step 4: Configure Perforce TeamHub extension

The Perforce TeamHub extension, named hth-extension, is required to create events for stream and classic depots. This extension supports the following events:

  • change-commit

If the extension is installed, you can view general and status information on the Configure P4 Server Extensions page. You can also install and remove the extension from this page.

  1. Log in to the TeamHub admin UI.

  2. Click P4 Extensions.

    The Configure P4 Server Extensions page opens.

  3. Under TeamHub extensions, click Install.

    The extension is installed to the P4 Server.

    If the Install button is not available, configure the TeamHub administrator bot first.

Upgrade the Perforce TeamHub extension

You can upgrade the extension when a new version is available.

  1. Log in to the TeamHub admin UI.

  2. Click P4 Extensions.

    The Configure P4 Server Extensions page opens.

  3. Under TeamHub extensions, click Upgrade.

    The extension is removed and the new version is installed.

Remove the Perforce TeamHub extension

You can remove the extension from P4 Server.

  1. Log in to the TeamHub admin UI.

  2. Click P4 Extensions.

    The Configure P4 Server Extensions page opens.

  3. Under TeamHub extensions, click Remove.

    The extension is removed from P4 Server.

Step 5: Configure the Perforce TeamHub Graph extension

The Perforce TeamHub Graph extension, named hth-graph-extension, is required to create events for graph depots. This extension supports the following events:

  • branch create

  • branch delete

  • tag create

  • tag delete

  • graph-push-reference-complete

If the extension is installed, you can view general and status information on the Configure P4 Server Extensions page. You can also install and remove the extension from this page.

  1. Log in to the TeamHub admin UI.

  2. Click P4 Extensions.

    The Configure P4 Server Extensions page opens.

  3. Under TeamHub Graph extension, click Install.

    The extension is installed to the P4 Server.

    If the Install button is not available, configure the TeamHub administrator bot first.

Upgrade the Perforce TeamHub Graph extension

You can upgrade the extension when a new version is available.

  1. Log in to the TeamHub admin UI.

  2. Click P4 Extensions.

    The Configure P4 Server Extensions page opens.

  3. Under TeamHub Graph extension, click Upgrade.

    The extension is removed and the new version is installed.

Remove the Perforce TeamHub Graph extension

You can remove the extension from P4 Server.

  1. Log in to the TeamHub admin UI.

  2. Click P4 Extensions.

    The Configure P4 Server Extensions page opens.

  3. Under TeamHub Graph extension, click Remove.

    The extension is removed from P4 Server.