I am creating a new Azure DevOps custom task that will RUN ON "ServerGate". I have setup my HttpExecution for this task, and intend to use it for PRE and POST Deployment Approval Gate. When this executes for a Post Deployment Approval Gate, I would like to send the status of the job (i.e. Succeeded, Failed, etc) to my API. I thought I could just use "Agent.JobStatus" variable, but this is not resolving in the ServerGate.
Is there another variable I should use to get access to the status of the current stage (i.e. success?)?
Details on variables for Agent.JobStatus: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=classic
Details on authoring server gates I have been following: https://github.com/microsoft/azure-pipelines-tasks/blob/master/docs/authoring/servertaskauthoring.md
Example of my ServerGate:
"execution": {
"HttpRequest": {
"Execute": {
"EndpointId":"",
"EndpointUrl": "https://my-gate.com/ready",
"Method": "POST",
"Body": "{\"status\":\"$(Agent.JobStatus)\", \"name\":\"$(Release.ReleaseName)\"}",
"Headers":"{\n\"Content-Type\":\"application/json\"\n}",
"WaitForCompletion":"false",
"Expression": "eq(root['approved'], 'true')"
}
}
}
When this resolves in the output, the status just shows as: "$(Agent.JobStatus)".... while I am able to resolve the "name" into the actual name of the release definition in execution.
I expected to receive the proper status resolving on POST deployment gates to be "Successful", etc as indicated in the documentation noted above.