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

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.

Related

is it possible to create azure build pipelines using terraform code?

I want to Create Azure Build pipelines using Terraform code, but not able to find any proper documentation on this. Is it possible ?
I tried terraform documentation, expecting some documentation or video guide how to create Azure build pipelines using terraform code
is it possible to create azure build pipelines using terraform code?
The answer is impossible.
Hashicorp doesn't have a terraform provider for Azure DevOps now.
If you check the azurerm provider, only azurerm_data_factory_pipeline is available, no Azure DevOps build pipeline.
You should look at the Azure DevOps provider From Microsoft. It does contain a resource for build definitions but you will need to pass it the path to an existing YAML file, you can't create the YAML from Terraform.
If you have a "templated" YAML then you could create a process that commits the YAML to a repo then use Terraform to set up the definition.

How to configure YAML multistage pipeline release stages in Azure test plan settings

I have a multi-stage YAML pipeline using which I run my automated tests against different environments(Dev, Test, Pre-prod, etc). I wanted to run these automated tests directly from the test plan by configuring the build and release pipeline using Azure test plan settings.
But I couldn't see my release stages after selecting the build in the build pipeline dropdown. It is working fine for my classic UI release pipeline, not for the YAML muti-stage.
Does YAML multi-stage support this functionality?
This seems to rely on the "old releases". But the steps and code it generates could easily be ported over to the new YAML pipelines. But you'd have to do it by hand.
You could create a temporary "old style" pipeline, configure it to see what all gets generated and then duplicate those tasks to your YAML pipeline.

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?

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).

Cloning an Azure Devops yaml Pipeline

Azure Devops pipelines provide a clone functionality. This is super useful functionality for scaffolding pipelines. My yaml pipelines have a lot of variables, and it's difficult and error prone to reassign all of these variables from scratch.
The Azure Devops UI updated in the last week or so, and there doesn't seem to be an option to clone yaml pipelines anymore. Classic pipelines still have the clone option.
Can anyone figure out how to clone a yaml pipeline with the new UI?
Hmm I haven't used the clone feature, but have you investigated using variable groups or variable templates to make your life easier? You can link a variable group to Azure Key Vault to facilitate secrets.
I've never used a cloning option in YAML. But I wouldn't use so many Azure DevOps variables which were created in the UI. You have multiple options here:
Store the variables in your YAML file (not for secrets)
Store the variables in a YAML template (not for secrets)
Store the variables in a variable group (use Azure Key Vault or the Secure flag for secrets)
The variable group can be linked to multiple pipelines. But there is currently no scope available. So, if you have multiple environments, you have to name it like "myvariablegroup-dev", "myvariablegroup-prod". Hopefully, this feature to attach a variable group to an environment is coming in the near feature.
1,You can disable the multi-stage pipelines feature in preview features
On the top right corner of the page click the user profile and choose Preview features
Then disable the Multi-stage pipelines. Then you will see the clone option appear again.
2,The other workaround is to create a new pipeline and choose to use the Existing Azure PipelineS Yaml file while following the wizard. (which has the same effect with cloning yaml, they use the same azure-pipelines.yml file)
Then choose the same yaml file with the original pipeline.