Home > database >  Checking the deployment status in azure
Checking the deployment status in azure

Time:06-29

I am using below API to get the latest deployment status(If any release going on) from 3 pipeline's before starting an deployment in each pipeline.

"https://vsrm.dev.azure.com/ABC/DEF/_apis/release/deployments?definitionId=100&deploymentStatus=inProgress"
"https://vsrm.dev.azure.com/ABC/DEF/_apis/release/deployments?definitionId=101&deploymentStatus=inProgress"
"https://vsrm.dev.azure.com/ABC/DEF/_apis/release/deployments?definitionId=102&deploymentStatus=inProgress"

Based on count I am deciding whether the any run going on in pipeline if count > 0. I am working on logic where if any deployment going on in other pipeline then Deployment should wait for other to finish since all are deploying to same environment.

The status checking task also is in progress so it is going to infinite loop to wait if task is running. Is there any way to achieve this.

CodePudding user response:

Based on your requirement, you need to check the Deployment status of the release pipeline.

To alleviate your issue, I suggest that you can add an additional stage to each release pipeline and then you can add the check deployment status in the new stage.

Refer to my steps:

  1. Add a new stage before the deployment stage and add the status check steps.

enter image description here

  1. In the Rest API, you can add the definitionEnvironmentId parameter in the URL to check the specify stage.

For example:

 "https://vsrm.dev.azure.com/ABC/DEF/_apis/release/deployments?definitionId=102&deploymentStatus=inProgress&definitionEnvironmentId=xx"

In this case, you can separate the check status step and the deployment process.

For more detailed info, you can refer to this doc: Deployments - List

  • Related