Trigger script variables
You can use trigger script variables to pass data to a trigger script. All data is passed as a string. It is up to the trigger to interpret and use these data appropriately.
It is also possible to have the server and trigger communicate using STDIN and STDOUT. For more information, see Communication between a trigger and the server.
The maxError…
variables refer to circumstances that
prevented the server from completing a command, such as an operating
system resource issue. Note also that client-side errors are not always
visible to the server and might not be included in the
maxError
count.
The terminated
and termReason
variables indicate
whether the command exited early and why.
Any unknown variables remain in the trigger invocation. This preserves the trigger argument ordering, and might be a clue to authors that data they assumed to be available is not.
Argument | Description | Available for type |
---|---|---|
|
Either null or a string reflecting an action taken to a changelist or job. For example," |
|
%archiveList%
|
Filename containing files to be pulled | pull-archive
|
|
Command argument count. |
all except archive |
|
Command argument string. |
all except archive |
|
Command argument string that contains the command arguments as a percent-encoded comma-separated list. |
all except archive |
|
The number of the changelist being submitted. The abbreviated
form A A |
|
|
The root path of files submitted. |
|
%checkpoint%
|
The name of the newly created checkpoint if a checkpoint was taken during the journal rotation. | journal-rotate*
|
|
Triggering user’s client workspace name. |
all |
|
Client’s current working directory. |
all except archive |
|
Hostname of the user’s workstation (even if connected through a proxy, broker, replica, or an edge server.) |
all |
|
The IP address of the user’s workstation (even if connected through a proxy, broker, replica, or an edge server.) |
all |
|
The name of the user’s client application. For example, P4V, P4Win |
all |
|
The version of the user’s client application. |
all |
|
Command name. |
all except archive |
%commandIdent%
|
The unique identifier of a command. |
all |
%depotName%
|
The graph depot in which the repo resides. |
|
%email%
|
The user's email address. See Triggering for multi-factor authentication (MFA). |
|
|
Path of archive file based on depot’s |
|
|
First new changelist number. |
|
|
Path to temporary form specification file. To modify the form
from an |
|
|
Name of form (for instance, a branch name or a changelist number). |
|
|
Type of form (for instance, |
|
%fullname%
|
The user's fullname. See Triggering for multi-factor authentication (MFA). |
|
|
List of groups to which the user belongs, space-separated. |
all except archive |
%host%
|
The IP address of the host of the user. See Triggering for multi-factor authentication (MFA). |
|
|
A broker or proxy is present. |
all except archive |
|
A string of job numbers, expanded to one argument for each job
number specified on a |
|
%journal%
|
The name of the newly rotated journal. | journal-rotate*
|
|
Last new changelist number. |
|
|
One of |
all except archive |
|
Error number and text. |
all except archive |
|
Limit in milliseconds for data scans. Prevents the server from locking tables for too long. Counting begins when the first table is locked, and includes time spent waiting for any subsequent table locks. (See |
all except archive |
%maxMemory%
|
Limit in MB of the memory that a command can use. This value is an approximation. (See p4 help maxopenfiles .) |
all except archive |
%maxOpenFiles%
|
Limit of the number of files that can be opened by a single
operation. Prevents users from accidentally opening an excessive
portion of the repository. (See p4 help maxopenfiles .) |
all except archive |
|
Limit of the number of rows of result data that can be buffered. Prevents the server from using excessive memory. (See |
all except archive |
%maxScanRows%
|
Limit the number of rows of data scanned by a command. (See |
all except archive |
%method%
|
The authentication method from list-methods (may be set to "unknown"). See Triggering for multi-factor authentication (MFA). | |
%newValue%
|
See Triggering with depots of type graph. | graph-push-reference
|
|
If a changelist is renumbered on submit, this variable contains the old changelist number. |
|
%oldValue%
|
See Triggering with depots of type graph. | graph-push-reference
|
|
Operation: |
|
|
If the command was sent through a proxy, broker, replica, or
edge server, the hostname of the proxy, broker, replica, or edge
server. (If the command was sent directly,
|
all |
|
If the command was sent through a proxy, broker, replica, or
edge server, the IP address of the proxy, broker, replica, or
edge server. (If the command was sent directly,
|
all |
|
The host port to which the client connects. If the client
connects to the server through an intermediary, this will hold
the port number of the intermediary. If there’s no intermediary,
this will hold the same value as the |
auth-check-sso (client-side script only) |
%pusher%
|
The user credited with the push. See Triggering with depots of type graph. |
|
|
A double quote character. |
all |
%reference%
|
See Triggering with depots of type graph. |
|
%refFlags%
|
||
%refType%
|
||
%repo%
|
The repo, which has |
|
%repoName%
|
The name of the repo. See Triggering with depots of type graph. |
|
|
Revision of archive file |
|
%scheme%
|
The authentication scheme set by init-auth (can be set to "unknown"). See See Triggering for multi-factor authentication (MFA). | auth-init-2fa
|
|
The IP address and port of the
Helix Core Server,
passable only in the context of a client-side script specified by
|
auth-check-sso (client-side script only) |
|
Hostname of the Helix Core Server. |
all |
|
The value of the
Helix Core Server’s
|
all |
|
The IP address of the server. |
all |
|
The value of the
Helix Core Server’s
|
all |
%serverpid%
|
The thread ID that handles a command on Windows, and the PID on Linux/UNIX. | all |
|
The transport, IP address, and port of the
Helix Core Server, in
the format
prefix can be one of Note
The %serverport% variable returns the P4PORT of the server where the trigger runs. For example: changesubmit change-submit //... "bash change-submit.sh %serverport%" shelvesubmit shelve-submit //... "bash shelve-submit.sh %serverport%" Whether you are working through the commit server or an edge server, the change-submit trigger runs on the commit server. Therefore, the %serverport% variable for the change-submit trigger returns the P4PORT of the commit server. However, a shelve trigger runs on the server where you shelve a changelist. If you shelve a changelist through an edge server, the shelve-submit trigger runs on that edge server. This is true whether the shelve is being promoted or not. Therefore, in this case, the %serverport% variable for the shelve-submit trigger returns the P4PORT of that edge server. |
all |
%serverprocesspid%
|
The process identifier (PID) of the entire server process on both Windows and Linux/UNIX. | all |
|
The |
all |
|
A string specifying the role of the server. One of the following:
|
all except archive |
|
Version string for the server that terminated if the command
exited early. Reason for termination is given in
|
all except archive |
|
Expanded to the spec string of the form in question. |
|
%standbyserverid% | Expands to the serverID of the standby before failover (or failback). | failed-over, failed-back |
%standbyserverport% | Expands to the P4PORT of the standby before failover (or failback). | failed-over, failed-back |
%stream%
|
The stream spec in the change, such as //streamDepot/streamProject1 |
change-submit
|
|
If this is not a distributed installation,
In a distributed installation, for any change trigger:
If there is a forwarding replica between the commit server and
the edge server, then See |
Not available for |
|
The serverport of the target server being monitored. Corresponds to the P4TARGET or the |
|
|
The value of |
all except archive |
|
The reason for early termination. This might be one of the following:
See also |
all except archive |
%token%
|
The stashed token from the last init-auth (can be empty). See Triggering for multi-factor authentication (MFA). | auth-init-2fa
|
%triggerdir%
|
Pull.trigger.dir used for tmp files for Triggers for external file transfer | edge-content
|
|
Command to execute when trigger is fired. Last field of trigger definition. |
all except archive |
|
Third field in trigger definition. Its meaning varies with the trigger type:
|
all except archive |
|
Trigger name: first field from trigger definition. |
all except archive |
|
Trigger type: second field in trigger definition. |
all except archive |
|
Helix Server username of the triggering user. |
all |