3
votes

I am trying to use the VSTS release pipeline Gate feature to test a new Azure Function after it's deployed. I have tried the 'Invoke Azure Function' and 'Invoke REST API' deployment gates, but can't get them to succeed.

I would like to just call the endpoint and for the gate to succeed if it receives a simple HTTP 200 or 202 response.

Latest effort was to put this in the 'Success criteria' field

eq(count(jsonpath('$.responses[?(@.httpStatusCode != 200)]')), 1)

The Processing Gate step just says 'No samples have yet arrived' and there are no logs.

Has anyone successfully done this? Any ideas?

1
Thanks @Hackerman, I have been through all the docs and I can't find any usefule examples of Success ctieria...as usual!! - NER1808
Does the response from your Azure Function include the http status code? Can you share a response sample? - Eddie Chen - MSFT

1 Answers

3
votes

Just faced the same problem for the "Invoke Azure function" task and it is so, that if you simply need to check whether it's 200 or not you don't specify the "Success criteria" at all, it works out of the box. I hope it's the same with the 202.

like this

It's kinda mentioned in their documentation, but as usual you should read between the lines or something.

Completion Event - How the task reports completion. Can be API response (the default) - completion is when function returns success and success criteria evaluates to true, or Callback - the Azure function makes a callback to update the timeline record.

Success criteria - How to parse the response body for success.