Azure Devops: MultiStage Yaml Pipeline - Linked WorkItems always showing +50 - azure-devops

For our project, we created a multistage yaml pipeline which will trigger after CI pipeline completes.
a. Checked Automatically link work items included in this run
Problem:
suppose CI build trigger with a 5 number of linked workitems. However in multistage pipeline include items its always showing 50+ work items.
enter image description here
How can we see only related work items that got linked in CI (here 5 number of work items) ?
will workitems linked in CI pipelines can be shown in the multistage pipeline linked Work Items too ?
Can anyone help me on this. Please let me know, if you need any further details.
CI Pipeline (automatic trigger)
MultiStage Yaml Pipeline (which has Dev,Test,QA,Prod Stages) [ trigger based on CI pipeline]

Related

Azure DevOps Classic Release - Artifact Filter always triggering release

I have an Azure DevOps classic release pipeline
There are 2 artifacts (type build) with continuous deployment trigger enabled, and 2 stages
Each stage has an "after release" trigger with an artifact filter, to the respective build artifact.
The builds are for different repos.
However, both stage are being triggered when every build artifact is created, even when I manually create a release...
Expected behavior is:
Build A completes, only stage A is triggered
Build B completes, only stage B is triggered
When I manually create a release, I would like to choose which stage will be triggered. If this is not possible, the trigger both stages
Is this a bug or am I missing something?
Azure DevOps Classic Release - Artifact Filter always triggering release
For this issue ,I am afraid that it is currently not supported in azure devops. If you want different artifacts to trigger the deployment of different rows of stages respectively, it is better to create two pipelines, set the artifact in each pipeline to trigger the deployment on the required stages.
And you could check this topic on developer community
Sorry I should have clarified a bit more. I don't think that triggers will solve all use cases, but having triggers on stages would at least allow you to have the following:
Stage A has trigger /src/appA
Stage B has trigger /src/appB
If you commited (script, code, etc.) to /src/appB, it should use previous artifacts and only build appB and further if requested.
If you think that two artifacts only trigger a part of the pipeline is necessary, you could submit a feature request in our Develop Community site. Our PM and product team will kindly review your suggestion.

Azure Devops - trigger pipeline on Pull Request but not Push?

I have a ADO git repo with a YAML-based build pipeline that builds a docker image, runs some tests using Docker Compose, and then pushes the image and a helm chart to an ACR.
I'd like the have the build/test part run on PRs too. I have created a second pipeline that's just the first half of the normal build, and assigned it as a Build Validation pipeline for a branch.
However, I don't seem to be able to get the triggers right. If I have trigger: none in the test pipeline, it never triggers. If I have branch names, it is also run on merge alongside the normal build pipeline. How is this supposed to work? The docs define all the individual parts, but not really how they are expected to interact!
Am I supposed to have a multistage pipeline and use that somehow for the validation? (it's just 4 Steps in one Job in one Stage currently).
I am hoping to avoid building the same image too many times, or storing untested images anywhere outside the build agent.
I make it work with the following configuration:
In my YAML pipeline, I set the trigger: none.
In branch policies of a branch, I create a build validation with automatic trigger:
Then I create a pull request to that branch, and the pipeline runs automatically:
There are two possible mistakes:
The "Manual" trigger is selected in build validation, so that the pipeline needs to be run manually rather than triggered automatically.
The branch with branch policy set should be the same branch as the target branch of pull request.

Can I have one Azure Dev release pipeline that does PR releases to different environments based on the target branch of the PR?

I've been fighting with this for a while. I've been able to get it working with two separate release pipelines, but not with one. It seems that in one pipeline the PR trigger for releases fires for all environments, even with separate build artifacts.
Goal is to have the following in one release pipeline:
PR to dev and merge to dev deploys to dev environment
PR to main deploys to QA environment
Merge to main of said PR releases to prod (with manual approval step).
It would be great to get this one one release pipeline, as that would reduce overhead and management, etc.
I've tried all sorts of variations with artifact release triggers and the environment pre-deployment conditions, but to no avail.
I've even tried using 2 separate build pipelines (one for main, one for develop) and then loading both as artifacts and trying to separate that way, but even when only 1 build pipeline runs, it triggers the PR release condition for both environments.
You should be able to achieve this if you implement your release pipeline with the new YAML pipelines.
The simplest option (which is not quite what you are asking for but should get the same outcome) would be to create a template with your core deployment logic, then create separate pipelines that reuse this template. That should allow you to replicate the triggers that you already had working for two release pipelines without needing to duplicate the deployment code.
Alternatively, you could set up a single YAML pipeline with Stages for Dev, QA and Prod, and set conditions on the stages, based on the source branch and/or build reason.

Azure DevOps - Yaml pipeline publish release status to work item

First - I know that according to the official MS documentation the built in functionality for updating work items with release status via the deployment control is only supported in the release pipelines and not the multi stage YAML pipelines (see first note documented here: https://learn.microsoft.com/en-us/azure/devops/boards/work-items/work-item-deployments-control?view=azure-devops)
Has anyone used powershell or the Azure DevOps rest api's to create an addon or integration that can update the work item with the correct information to automate the linkage of work items to the release environment information given that this functionality doesn't appear to be available for the yaml release pipelines?
Yes. The Deployment field is not supported by Yaml Pipeline. This feature is only for Release Pipeline.
If you want to link Yaml Pipeline to Work item, it can be linked as Build type.
To achieve this in YAML pipeline, you can try to use the Task: WorkItem Updater task
from WorkItem Updater
- task: WorkItemUpdater#2
displayName: 'WorkItem Updater'
inputs:
workItemType: xx
workitemLimit: xx
linkBuild: true
Result:

Create pipeline that consists of multiple pipelines

Is there a possibility to create a release pipeline, that consists of other pipelines?
Assets
In my case I have following pipelines:
- build job Job1 (to build some application artifacts)
- build job Job2 (to build some application artifacts)
- build job Job3 (to build other artifacts, e.g. tests)
- release job Release1 (to deploy application form artifacts from Job1 and Job2)
- release job Release2 (to prepare special DB for tests)
- release job Release3 (to run tests from Job3)
Each of above build consists of many tasks and task groups.
Goal
Is to prepare following pipeline, that will be scheduled every night (so just a regular nightly build-release):
[trigger: at specific time] -> (Job1, Job2, Job3) -> Release2 -> Release1 -> Release3
Restrictions
I can not merge any of mentioned jobs/releases, because we need to run some of them independently.
Ideas
One thing I conciser was to make task groups out of all jobs and releases (that already consists of task groups...) and to prepare new release pipeline, but this idea sounds like not-the-best option.
You may be able to accomplish this via the Trigger Build Task Azure DevOps extension. However, you should note the warning under the "Known Issues" section regarding using this extension with Release pipelines. Under this approach you'd create a single "mega" pipeline comprised of various calls to the extension which would trigger your existing build and release pipelines.
In my view, a better approach would be to adopt the use of YAML templates to create YAML based pipelines. You could create a template for each stage you've outlined in your question and then simply reference the template in your pipelines. This way you could have your standalone pipelines and your "mega" pipelines referencing the same templates to promote re-use and improve maintainability. There is even an easy way to export your current "classic" pipelines to YAML.