Saving Release pipeline in yaml - azure-devops

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?

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 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:

Trigger for yaml release pipeline

I need to know if it is possible to trigger a yaml release pipeline from a Classic Release pipeline.(the one created from the Releases tab under pipelines)
The answer is Yes. You can use the Trigger Build Task extension and queue the YAML pipeline from the release:
Or use Trigger Azure DevOps Pipeline extension.

Can I create Release pipeline (CD) in Azure DevOps directly using YAML?

I need to create a release pipeline (CD) without creating a CI pipeline. I will use artifacts from GitHub. Can I create the CD using YAML or it is like I need to create CI with YAML and CD can not be created directly using YAML ?
You can't create Release classic pipeline using YAML. Your only option is the editor. But YAML has something different (which in the future can replace Release pipelines - this is my personal opinion). It is job deployments. Please take a look here.

AZ Devops Yaml Release?

I don't know if is already released az devops extension to create pipeline release with AZ CLI.
There are post relating to 1y ago.
I found documentation here but I can't understant how to create various stage of release pipeline.
https://learn.microsoft.com/en-us/cli/azure/ext/azure-devops/pipelines/release?view=azure-cli-latest#ext-azure-devops-az-pipelines-release-create
Someone has already created release pipeline with yaml and tell me how please? Or just post some command to import into Azure-DevOps project?
For this issue , right now there is no way to automate the creation of classic release definition. You will need to create the definition and then you can queue a Release run using az pipelines release create command.
The role of az pipelines release create command is to kick off a new release for an existing release pipeline, not to create a new release pipeline.
You can refer to this issue on github about this.
So as a workaround , it is possible to automate the new yaml pipeline definitions with az pipelines create command which can constitute both build (CI) and release (CD).
First you can create a yaml file(e.g. azure-pipelines.yml) in the repo and set the definition for both CI and CD pipelines in the yaml file. YAML schema reference can give you guidance.
Then you can create an Azure Pipeline for a repository with the pipeline yaml already checked in into the repository via az pipeline create command. Specify --yaml-path in the command.
--yaml-path --yml-path :
Path of the pipelines yaml file in the repo (if yaml is already
present in the repo).