Define approvals in yaml release pipelines - azure-devops

I am working on release pipelines and looking into any mechanism to define release approval flows in Yaml. I checked the Rest API too and could not find any pointers.
I am looking into a approval process where a deployment to an environment would need approval with a timeout setting.

EDIT: In sprint 155 (7/30) Microsoft released approvals for YAML pipelines that use Environments:
The pipeline run deploying to the environment will stop for approval at the start of the stage:
First answer:
This feature not exist yet in the YAML (multi stage) pipelines.
The feature is on the road map and planned to be in Q2 but the work item state still "In Progress".
It's really useful and basic release process and I hope it will be available soon.

Related

How to build a dashboard for YAML Pipelines with deployment job

We have been converting our Release pipelines in Azure DevOps to instead be YAML files that run as Pipelines. This is so we can store our deployment process as code. The deployment process is working well - so a developer commits code and the Pipeline builds and publishes the artifact in one stage and then it auto-deploys to the QA environment in another stage. Subsequent stages deploy to an Environment (e.g. QA, Staging, Production) each of which requires some approval(s). The deployments themselves aren't the issue.
What I'm struggling with is unlike the old Releases there isn't a dashboard that will tell me which version of the project is in each environment. The Pipeline summary represents each stage for the Run as a dot (running, succeeded, failed, canceled, etc.) but wasn't built to represent what each environment has (probably because a stage doesn't have to be a deployment).
Is there somewhere else I can look for this information or do I have to build my own dashboard by calling the AzDO APIs? Looking at the Environment gives a list and I can root through the history, but that's not the experience our developers are looking for.

azure devops dashboard for multi-stage pipeline

I create a multi-stage pipeline in YML file including build stage and deployment to dev, test and production.
I ant to have a dashboard to show me the status of deployment and which release version was deployed to each stages?
I check the "Deployment Status" widget, but it only work with release option.
So anybody has experience to support me?
I am afraid that there are no out-of-the-box widgets to display the stages of the YAML pipeline and the status of each stage on the azure devops dashboard. Currently, the Release Pipeline Overview widget accomplishes this but it cannot be linked to a YAML pipeline.
Until now, in our official feature suggestion for Azure Devops forum, there has been a such suggestion exist in it: ADO Dashboard Widget-Release Pipeline Overview should support YAML Pipelines. You can add your vote directly at the above linked feedback. Voting helps increase the priority of the suggestion by consolidating customer impact under one feedback. The product team would provide the updates if they view it. Thank you for helping us build a better Azure DevOps!
Here is a ticket with similar issue.

YAML Release into Environment, Post deployment condition

In Classic UI Release pipelines, you can specifiy pre-stage and post-stage Gates.
However using YAML releases, and projects Environments, you can only use the Approval & Checks feature on the Environment.
AFAIK this only behaves as an pre-deployment gate. Is there a way to perform a post-deployment check using YAML releases?
Sorry, it's not available right now. But there is a related feature request in our user voice site:
Add pre and post-deployment approvals for multi-stage pipelines (YAML), similar to release definitions
https://developercommunity.visualstudio.com/idea/567845/add-pre-and-post-deployment-approvals-for-multi-st.html
Kindly vote up and track the status on it. Our PM will also review it.

How to use Environments feature with pipeline release stage

I have defined a release pipeline using the classic view, now I'm wondering if it's possible to connect an Azure pipeline Environment with and existing stage in the release pipeline. If it's possible how can it be done?
It seems you refer to the new Environment in the preview, the features there include:
Traceability of commits and work items
Deployment history down to the individual resource
Deeper diagnostics, and (soon) approvals and checks etc
From this document,it seems that the environment feature can only be used in yaml . The sample given are all in yaml. It should be currently not supported in the classic view.
You can also refer to the Building your first multi-stage pipeline with environments part of this blog .

Azure DevOps Release Pipelines: Letting release flow through multiple environments with manual triggers

I'm trying to configure Azure DevOps Release pipelines for our projects, and I have a pretty clear picture of what I want to achieve, but I'm only getting almost all the way there.
Here's what I'd like:
The build pipeline for each respective project outputs, as artifacts, all the things needed to deploy that version into any environment.
The release pipeline automatically deploys to the first environment ("dev" in our case) on each successful build, including PR builds.
For each successive environment, the release must have been deployed successfully to all previous environments. In other words, in order to deploy to the second environment ("st") it must have been deployed to the first one ("dev"), and in order to deploy to the third ("at") it must have been successfully deployed to all previous (both "dev" and "st"), etc.
All environments can have specific requirements on from what branches deployable artifacts must have been built; e.g. only artifacts built from master can be deployed to "at" and "prod".
Each successive deploy to any environment after the first one is triggered manually, by someone on a list of approvers. The list of approvers differs between environments.
The only way I've found to sort-of get all of the above working at the same time, is to automatically trigger the next environment after a successful deployment, and add a pre-deployment gate with a manual approval step. This works, except the manual approval doesn't trigger the deployment per se, but rather let an already triggered deployment start executing. This means that any release that's not approved for lifting into the next environment, is left hanging until manually dismissed.
I can avoid that by having a manual trigger instead of automatic, but then I can't enforce the flow from one environment to the next (it's e.g. possible to deploy to "prod" without waiting for successful deployments to the previous stages).
Is there any way to configure Azure DevOps Release Pipelines to do all of the things I've outlined above at once?
I think you are correct, you can only achieve that by setting automatic releases after successful release with approval gates. I dont see any other options with currect Azure DevOps capabilities.
Manual with approval gates doesnt check previous environments were successfully deployed to, unfortunately.
I hope this provides some clarity after the fact. Have you looked at YAML Pipelines In this you can specify the conditions on each stage
The stages can then have approvals on them as well.