Change-failed triggers
Use the change-failed trigger type to create triggers that fire if the changelist commit failed. This trigger only fires on errors occurring after a commit process has started. It does not fire for early usage errors, or due to errors from the submit form. If a change-*
trigger could have run, the change-failed
trigger will fire if that commit fails. This trigger does not run on edge or replica servers.
Example
This change-failed trigger sends an email to the user who submitted the change if the submit fails.
#!/bin/sh #failed-submit.sh - Notify users when a submit fails changelist="$1" user="$2" workspace="$3" # Get the email address of the user from p4 user -o. emailaddress=$(p4 user -o "$user" | grep "Email:" | \ grep -v \# | cut -b8-) # Mail the user that their submit failed mail -s "Change $changelist submission failed" "$emailaddress" <<EOM Submit failed for change $changelist submitted using workspace $workspace by user $user . Fix any problems and then submit again using 'p4 submit -c $changelist'. EOM exit 1
To use the trigger, add the following line to your triggers table:
chgfail change-failed //depot/submitfail "failed-submit.sh %change% %user% %client%"