Helix Core Server Administrator Guide: Fundamentals (2019.1)

Triggering before or after commands

Triggers of type command allow you to configure Helix server to run a trigger before or after a given command executes. Generally, you might want to execute a script before a command runs to prevent that command from running; you might want to run a script after a command if you want to connect its action with that of another tool or process.

Note

You may use command type triggers with p4 push and p4 fetch commands.

The following table describes the fields of the command trigger.

Field Meaning

type

command

The command to execute is specified in the path field.

path

The pre-user-command value specifies the command before which the trigger should execute.

The post-user-command value specifies the command after which the trigger should execute.

command can be a regular expression.

For additional information about the grammar of regular expressions, see p4 help grep.

Examples of possible values:

  • pre-user-login
  • post-user-add
  • post-user-edit
  • pre-user-obliterate
  • pre-user-sync
  • post-user-sync

To match a command name that is a substring of another valid command, use the end-of-line meta-character to terminate matching. For example, use change$ so you don’t also match changes.

For additional information about path values with p4 push and p4 change commands, see Additional triggers for push and fetch commands.

You cannot create a pre-user-info trigger.

command

The trigger for Helix server to run when the condition implied by path is satisfied.

Specify the command in a way that allows Helix server to locate and run the command. The command (typically a call to a script) must be quoted, and can take as arguments anything that your command is capable of parsing, including any applicable Helix server trigger variable.

When your trigger script is stored in the depot, its path must be specified in depot syntax, delimited by percent characters. For example, if your script is stored in the depot as //depot/scripts/myScript.pl, the corresponding value for the command field might be "/usr/bin/perl %//depot/scripts/myScript.pl%". See Storing triggers in the depot for more information.