Extensions

P4 server extensions are a way for administrators to customize workflows and extend P4 Server functionality.. These extensions allow you to extend product behavior in a close integration between the P4 Server runtime and your custom logic.

Server extensions are self-contained bundles of code, metadata, and other assets that interface with P4 Server through the extensions Classes and methods. The extension code runtime is embedded within the P4 Server.

Server extensions are versioned in a special extensions depot.

The output of the p4 depots command does not list the Extensions depot because this special depot is not for the ordinary user. Instead, the Extensions depot is for the administrative user with super access (see p4 protect). The command to manage server extensions, p4 extension, requires super access.

Advantages over triggers

Server extensions provide several advantages over triggers:

  • Use a single scripting language (Lua) across supported platforms.

  • Integrate directly with P4 through the server extension API.

  • Support global or depot-specific configuration.

  • Allow authorized users to manage extensions within repositories or depots they own without requiring ongoing superuser involvement.

  • Remain compatible across product upgrades through API and runtime version pinning.

  • Use server-managed installation, execution, and replication.

  • Support internationalization (i18n).

  • Can issue pre-authenticated P4 commands, removing the need to manage authentication tickets within the extension.

  • Simplify administration through the p4 extension command and extension configuration specifications, rather than a single triggers table. See Server extension configuration (global and instance specs).

  • Include libraries for common tasks such as web requests, email, and storage.

See also:

Getting started with server extensions

If you are new to server extensions, start with:

In this section: