Execute YAML Release pipeline using Azure CLI - azure-devops

My release pipelines are YAML based and I want to trigger it using CLI. The pipeline has multiple stages/environments like DEV, SIT, QA, UAT. If I trigger the pipeline using
az pipelines run --organization $(org) --project $(proj) --name $(pipeline-name) --branch $(pipeline-branch)
it triggers the pipeline and deploys from DEV.
My need is to run the pipeline for a specific environment, say if I want to deploy only to SIT and not start from DEV how to do it.
No --environment or --stages exist in az pipelines run.
Tried with REST API as well but could not due to poor documentation.
Please help me in triggering the pipeline for deployment directly to a specific environment ?

Related

Can Azure DevOps pipeline run make targets?

In our project we used GitHub actions to run make targets for CI pipeline. We had dedicated runners used in Github actions to run make targets
Now, we migrated from GitHub actions to Azure DevOps pipeline
Does Azure DevOps pipeline allow/support running make targets?

Run automated tests from Azure Test Plans using a YAML pipeline

Until recently I ran Selenium automated tests from the Azure Test Plans using a YAML pipeline for the Build part and a classic Release Definition for the Release part.
Now, the organization I work in does not allow the use of classic Release Definitions from Azure DevOps.
So I extended my YAML Build Pipeline with stages for running my automated tests on different environments.
But I also want to make use of the Azure Test Plans for running my tests.
My problem is that when I want to run a test from my Test Plan, the only possibility for selecting a Release pipeline is the classic Release Definition I have created.
Is there any possibility to trigger the run of my automated tests from the Azure Test Plans, but to use a YAML pipeline when selecting the Stage.
Thank you!
I tried to edit the settings of my Test Plan, but in order to select a Stage, I have to select a Release Pipeline, and the only options are the ones existing in the Pipelines -> Releases windows of Azure DevOps

Azure Bicep in DevOps release pipeline

I have an existing Azure DevOps release pipeline that deploys resources using Azure CLI to multiple environments DEV, TEST, PROD.
I'd like to switch gradually to using Bicep files.
Microsoft's Quickstart: Integrate Bicep with Azure Pipelines shows how to build a build pipeline using an inline CLI scipt, but I wasn't able to find help on how to setup a bicep task in a release pipeline.
There are no official bicep tasks for release pipelines like there are for ARM files.
Do I need to use a Azure CLI script task type to run something like
az deployment group create --resource-group $(resourceGroupName) --template-file $(templateFile) --parameters "{ \"someparameter1\": { \"value\": \"$(someparameter1)\" } }"?
Bicep is a domain-specific language that compiles into ARM-templates, so you have (at least) two possible approaches here:
either you deploy bicep templates with the az deployment group create -command without building them (in which case the az -command compiles Bicep into an ARM-template and deploys that)
OR
you compile the bicep template yourself with bicep build (or az bicep build) and deploy the ARM-template it creates like you have deployed them before.
The first approach is more straightforward, the latter might fit better to your existing approach if you have, for example, existing separate build and release pipelines or utilize some kind of testing for the ARM-templates before deploying them.
Here is a really good tutorial that provides an answer to your question https://learn.microsoft.com/en-us/learn/paths/bicep-azure-pipelines/ It's also very well written.

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

AzureDevops build step passed even when Octopus build failed due to space issue on server

We are using AzureDevops integrated with Octopus Deploy. Currently, Create octopus release step in AzureDevops showed as passed even when it failed in Octopus due to space issue on server. Any idea how to force AzureDevops to show this as failed step as well.
I think the issue here is that Azure DevOps pushes the packages to Octopus, and you've created the release but not asked it to check in on the status of the deployment.
I have an Azure pipeline building, packaging and pushing to Octopus and it looks like the below:
Azure DevOps Pipeline
I have it create an Azure Release which deals with Creating the Release, Deploying to Dev, Test and lastly Production as below:
Azure DevOps Release Pipeline
I'd recommend in your Create Release and Deploy step to "Show Deployment Process" as this will pipe the logs from Octopus to Azure DevOps and mark the Azure DevOps job appropriately. Box below:
Azure DevOps Show Deployment Process button
Please let me know how you get on.
Thanks