We have a requirement where after the QA2 Release we have to trigger a build which will do some activity in qa2 and create a build. We have to pass some parameters or change some if build fails so we cannot keep it in the normal release pipeline. We wanted to know if there is any way to keep check so that if the build passes then only it will be allowed to be deployed to prod otherwise shouldnt allow.
Is there any gates or checks available to make this possible?
Sure, you can use the Gates on the "Pre-deployment conditions" of PROD stage. you just need to use the Invoke REST API check to call the REST API "Latest - Get".
Go to "Project Settings" > "Service connections" to create a Generic service connection. The values of the following two field are required.
https://dev.azure.com/{orgName}
. The {orgName}
is the actual name of your Azure DevOps organization.On the "Pre-deployment conditions" of PROD stage, enable Gates and add the Invoke REST API check with below configurations.
Connection type: Generic
Generic service connection: Name of the Generic service connection create previously.
Method: GET
Headers (json):
{
"Content-Type":"application/json",
"Authorization": "Bearer $(system.AccessToken)"
}
URL suffix and parameters: /{projName}/_apis/build/latest/{definitionId}?api-version=7.0-preview.1
The {projName}
is the actual name of your project, and the {definitionId}
is the definition ID of the build pipeline (QA2 Test Build
).
Advanced > Completion event: ApiResponse
Advanced > Success criteria: eq(root['result'], 'succeeded')