Azure DevOps - Yaml pipeline publish release status to work item - azure-devops

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:

Related

Is there a way to export release pipleines to YAML in azure devops

Is there any way I can export a release pipeline in Azure devops to YAML?
Currently, Azure DevOps can't export a Release Pipeline to YAML.
But individual tasks within stages and jobs can be exported from release pipelines by clicking the “View YAML” button at the right upper side of a task.
This features is On Roadmap for implementation.
Support this feature # https://developercommunity.visualstudio.com/t/export-entire-azure-devops-buildrelease-pipelines/733456
References
https://developercommunity.visualstudio.com/t/export-a-release-pipeline-as-yaml/918911
Migrating existing (entire) Azure DevOps pipeline to YAML based pipelines (in bulk)

Azure Devops yaml deployment pipelines shows unwanted message / description

Recently I migrated from the traditional Graphic deployment pipelines to the reusable yaml build and deployment pipelines.
The yaml build pipelines are delivering (multiple) artifacts which are used in a deployment pipeline.
When running the deployment pipeline (making use of parameters and settings), yaml templates, etc...
I see, when the pipeline is finished, a description like:
<build id> - <latest check-in message where the deployment pipeline
is located>
Since the deployment pipeline is not located in the same repo as the build pipelines, the message/description does not relate to the actual state.
Is it possible to change these messages/descriptions so when I display the runs of the pipeline I can see what is important for me, instead of the last check-in message?
Thanks, Bart
This pipeline setting will stop it adding the commit description when it prints the pipeline run name:
appendCommitMessageToRunName: false
Ref: https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/pipeline?view=azure-pipelines#pipeline-stages
Note: this is a new feature as of September 2022; previously, the commit message was always shown.

Deploy a preexisting artifact in a Azure DevOps Multi-Stage pipeline

In Azure DevOps classic pipelines you can have a build pipeline for creating the artifact and a release pipeline for deploying it. This means that whatever stored prexisting artifact could be deployed simply launching the release pipeline and selecting the artifact´s version (typical usage: rolling back the current deployed artifact to a previous version)
How this can be achieved in Multi-Stage pipeline? Any way of launching only the deployment stage selecting the artifact to be deployed?
Regards
How this can be achieved in Multi-Stage pipeline? Any way of launching only the deployment stage selecting the artifact to be deployed?
Indeed, this is very convenient to choose prexisting artifact based on actual demands, but what you want does not supported in Multi-Stage pipeline until now.
This request already reported to the MS product team:
Select artifacts in YAML release pipeline
This feature have been added in the last sprint:
Pipeline resource version picker in the create run dialogue
However, as I test, it seems this feature has not been deployed in all regions:
If it not deployed in your region, you could try to use the task Download Pipeline Artifacts task with the runId input:
- task: DownloadPipelineArtifact#2
inputs:
source: 'specific'
artifact: 'drop'
path: $(Build.SourcesDirectory)/bin
project: 'AndroidBuild'
pipeline: 12
runVersion: 'specific'
runId: $(buildid)
Then use pass queue variable buildid when we queue the build:
Hope this helps.
This can be done by having two pipelines. one pipeline for your build where your pipeline produces an artifact and create another pipeline for your release stages. In the release pipeline, you can set the resources to point to another build or pipeline. where you can consume your previously produced artifact(including older build version) to deployment stages.
See:
YAML Resources
Your release YAML pipeline can specify what resources it needs. You can specify an existing build or another pipeline.
resources:
pipelines:
- pipeline: SmartHotel-resource # identifier for the resource (used in pipeline resource variables)
source: SmartHotel-CI # name of the pipeline that produces an artifact
However, Keeping them separate just leads to move overhead and maintenance.

Saving Release pipeline in yaml

Just like build pipelines I Want to save release pipeline in yaml and version control it in git, diff, merge, revert
it is possible to download release pipeline in yaml format
To enable YAML Release Pipeline, you need to enable Multi-stage YAML pipelines in Preview features:
Check Multi-stage YAML pipelines for more information.
Here are some documents and cases you can refer to :
YAML schema reference
Converting Classic Azure DevOps Pipelines to YAML
Using Azure DevOps, how do I migrate a release pipeline to code,
similar to build pipeline yml?

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 .