I want to add the job status in the subject line of the email notification of Octopus Deploy. Can you please tell me the system variable to use or another way to add the status?
How do I add the job status (success or failure) in the email notification?
1.7k views Asked by Mohammed At
3
There are 3 answers
0
On
As a work-around you could use two steps for sending the 'status-email':
- One step sending 'success'-email. This step should have its 'Run condition' set to 'Success: only run when previous steps are successfull'.
- Another step sending 'failure'-email. This step should have 'Run condition' set to 'Failure: only run when a previous step failed'.
Perhaps the system-variables Octopus.Deployment.Error Octopus.Deployment.ErrorDetail could also be helpfull.
Source: http://docs.octopusdeploy.com/display/OD/System+variables#Systemvariables-DeploymentStatusTrackingdeploymentstatus
So to apply this to your email subject (assuming you're using the inbuilt Send Email step:
FYI: the box circled allows you quick access to the variables list.
You probably want to tweak the value to be closer to this, though
As an extension to this answer; you can iterate over all steps and output their status, I guess.
Syntax here: http://docs.octopusdeploy.com/display/OD/Variable+Substitution+Syntax#VariableSubstitutionSyntax-Repetition (look for the Repetition heading)
Example output