The Tasks API has a property “HasWarningsOrErrors” attached to it, but unfortunately there is currently no way to access this during a deployment (at least as far as I can see). I was hoping to use something similar to one of the following:
I’m assuming you want to get access to the HasWarningsOrErrors within the currently running deployment? Currently, if we get a warning during the deployment we don’t set any variable but if an error is encountered we set the Octopus.Action[_StepName_].Status.Error and Octopus.Action[_StepName_].Status.ErrorDetail variables so you could use those within a deployment.
Outside of the deployment you can retrieve the ServerTask during the running of the deployment and check the HasWarningsOrErrors property as it will be updated as soon as we hit a warning or error.
Worst case, you could retrieve the task details (api/tasks/{id}/details) and loop through all the LogElements of each ActivityLog entry on the task and see if any of their ActivityLogEntryCategory property are Warning|Error|Fatal.
Not sure if any of this will help you, but that’s all we have currently
The intended use is to customize both email and slack notifications. We have a number of scenarios where a deployment to certain environments is allowed but frowned upon for (such as deploying to Staging while using pre-release dependencies). We have to allow it for certain business needs, but we want to warn people that it cannot go to production. The goal was to check a certain variable for truthy status and then alter our notifications accordingly.
The following tickets both explicitly mention warnings, and one of them got a github issue a while back, but warnings were left out of Status so it didn’t cause a breaking change when checking Status == Success.
Is it possible to include the same task.HasWarningsOrErrors as a variable? I know I can add code to query the API and find the status, but it seems that’s something that should be readily available.