Run Azure Release Pipeline stage if one of many dependent stages runs - azure-devops

We have a rather large deployment surface, say 10 apps that get deployed. For patch releases we sometimes deploy only one app and I'd like to have a stage run either after all 10 are deployed or if only one is deployed. A simplified graph looks like the following. The "Do Something" step will only run if all three app stages run and I don't want to have to duplicate it for each app so looking for a better way. I guess that I could live with it if it just ran one time on any successful dependent stage (doesn't need to wait for all of them).

So I think there are a couple options for this. Will need to look at YAML Multi stage release pipelines. Specifically, deployment jobs
First depending on complexity of the "Do something" stage, it could be a job template and loaded into each of the app stages. I realize you mentioned you don't want it to run every time so this is just an option.
The second option is if the pipeline is being ran adhoc you will have the ability to select which stages are ran. Thus you could manually select the app stages to run and select the "do something stage" It will look something similar to this. The hard part will be working on the dependencies:
I'd assumed you'd want the "do something" to be dependent on the success of one of the previous stages.

Run Azure Release Pipeline stage if one of many dependent stages runs
I am afraidthere is no such out of way to achieve this at this moment.
That is because there is no "OR" syntax for the depend on. And we could not add the condition for the depend on.
You could submit this request condition "OR" to our UserVoice site (https://developercommunity.visualstudio.com/content/idea/post.html?space=21 ), which is our main forum for product suggestions. Thank you for helping us build a better Azure DevOps.
As workaround:
The main idea of the solution is: You could try to set depend on for the stage Secure with [], then add a Inline powershell task before other tasks. This task will call the REST API Definitions - Get to monitor whether all the stages in the current release pipeline have inprocess and queue states. If so, wait for 30 seconds, and then loop again until all other stages in the current release pipeline have no inprocess and queue states. Then next execute other tasks will be executed.
You could check my previous ticket for detailed info:

Related

List multi-stage automated test run results, on a per-stage basis, using Azure DevOps GET Api?

Is there a way to list multi-stage automated test run results, on a per stage basis, using Azure DevOps GET Api?
If you call /_apis/pipelines/{pl_def_id}/runs , you will get a list of builds from a defined pipeline.
If you get the latest build from that list, and if that build is multi-stage, the test runs do not seem to be hierarchically beneath the latest build, as you might expect.
To get the test runs, when you call /_apis/test/runs, ( https://learn.microsoft.com/en-us/rest/api/azure/devops/test/runs/list ) it only can give you the list of ALL runs within your org+project. There does not seem to be an id that references the multi-staged "test runs" tasks back to the "parent pipeline" having a "build id".
I looked at timeline queries, but they don't seem to have that info either.
HOW can this be achieved with ADO GET api? Am I overlooking the answer?
There is a parameter buildUri in the run list API as you mentioned the doc:Run List
You can use buildUri to get test runs from a specified build of pipeline.
However, if you want to get multi-stage automated test run results on a per stage, I’m afraid that there’s no supported API to achieve it.
You may submit a feature request at website below:
feature request

Azure DevOps - schedule release deployment is not available

In Azure DevOps you can schedule a release as many times as possible. In my example, I want to create a release 3 times a day Monday - Friday
But, if I need to actually deploy those releases 3 times a day Monday - Friday, I can't. There is only one slot available and user can't add more.
Is this a limitation of Azure DevOps and how I can actually deploy my release (not create them) 3 times a day?
This is not available at present.
Not sure if totally got your point, what you are looking for is something similar to schedule redeploy.
When you submit a pre-deployment approval for a stage, you can defer the deployment until a specified time. You could not select or specify multiple times here.
You could submit a feature request in Develop Community: https://developercommunity.visualstudio.com/spaces/21/index.html
As Patrick pointed out, this currently isn't possible. You can set multiple schedules for a release but individual stages can't be scheduled more than once. As a workaround, you could clone the stage and then set different schedules for it.

Azure DevOps scheduled release with approvals

I have a question concerning a release pipeline with both a schedule, as well as approvals.
Right now, the pipeline flows as follows:
A new build is triggered by a merge on our master branch
From the new build, a new release is automatically created
The schedule of this release is to wait until Saturday morning 3 AM to fire
On 3 AM, it sends approval requests for the people in the pipeline
After approval, the release happens
Steps 3, 4 and 5 are in the wrong order for our process. What it actually should do is:
Ask for approval
After approval, schedule the build for a release on Saturday 3 AM
Initiate the release
I can get there by introducing an empty stage that only handles the approval part, and in a next stage handle the deployment per schedule. But that seems like a workaround for something that should be doable in a better way. So am I missing an option here, or is this the way to do it?
#ChamindaC is correct. Your solution to have an Approval Stage that would precede the Scheduled stage is how the ordering of approvals and triggers can be accomplished.
I believe the order of appearance in the per stage Pre-deployment Conditions menu is also the order of execution.

best way to implement manual stage

I see many examples of waiting for input to implement a manual "promotion" stage.
This leaves the impression of many jobs running (it is possible in our pipeline to promote any of the last builds to a major release).
Is there a better way to achieve this, or, are there plans to have a real manual step that dosn't leave Jenkins looking like its running loads of jobs

Can Go (CI server) send mail for each failed build regardless of pipeline?

I'm using Go as my continuous integration server. I'm trying to get it to send an email if any stage in any pipeline breaks. So far, all I've found is a per-user email configuration, which forces me to add an email event per stage, per pipeline and per event. With 15 stages across 10 pipelines, and 3 events to trigger on, that's a lot of configuration.
Is it possible to configure it for all pipelines and all stages at once?
Post Go 14.3 you can add notifications for all pipelines and all stages at once. You would need to select the option similar to the one shown in the image below:
You could refer to the documentation for more details.