Start ARM template deploy conditionally in Azure Devops - azure

My source code is on GitHub.
I have an Azure Devops pipeline set up to build and deploy the application to an Azure subscription.
I also have the full azure environment defined in ARM templates.
I'd like to run the template deployment only when a specific folder changes in my GitHub repo.
Path triggers are only for Azure Devops repos.
Other possible solutions I investigated, but there is no clear documentation on how to achieve this exactly:
Custom condition on build or release task.
Pre-deployment conditions. Maybe artifact filters?
Pre-deployment Gates?
The ARM template deployment is idempotent, I know, but it takes a several long minutes to run even if there was no infrastructure change and I'd like to avoid that time wasted on every build.

Sounds like you have a single pipeline for both the infrastructure and application code. I have separate pipelines for each, one for infrastructure as code and other builds/pipelines for applications, NuGet package creation, etc. Perhaps split the pipeline and have the application deployment trigger after and separately from the infrastructure deployment pipeline. That way the application build and deployment can run in a more frequent cycle.

Related

Azure Synapse Analytics - CI/CD workspace and infrastructure - Design question

I have an Azure Repos project with IaC code and ci/cd yaml pipelines to set up Azure Synapse infrastructure. Can you recommend what is right approach when I integrate the workspace to connect to git? Should I create a new project in Azure Repos for the Synapse artifacts or should I use the same repository as the infrastructure project?
I will be setting up ci/cd pipelines to deploy the azure synapse artifacts as well.
Thanks!
Here's an answer to a similar question I posted:
You'll want to follow Microsoft's guide on CI/CD with Synapse. This is a great walkthrough video for the process.
Work in your development environment and commit to your collaboration branch.
A pipeline triggers off of your workspace_publish branch, releasing your code to your next environment (preferably with an approval gate)
Continue releasing the same code to higher environments, again with approval gates.
For Azure DevOps, you can use variable groups to parameterize your pipeline. Also make sure to read through the custom parameters section on that link to parameterize parts of the template that are not parameterized by default.

Will ADF deployment using azure devops affect existing Pipelines/Jobs in the environment

I am implementing azure devOps in Azure Data Factory.
My development environment ADF is integrated to a git repository.
I have created a build pipeline for building artifacts when there is a change in adf_publish branch.
My next step is to deploy the ARM template artifact to the PROD environment.
Suppose there are many triggered pipelines in the PROD environment and few pipelines were running in the PROD env at the time when the DEV changes are getting deployed to PROD.
My questions are:
How the changes are deployed from DevOps to PROD environment? Will it delete and replace all the pipelines and triggers from DevOps or It will pick only the changes and update the PROD env without touching the unchanged pipelines?
Suppose a pipeline is running in PROD env at the time of deployment, what will happen to that pipeline run?
Suppose there is a triggered pipeline at 3:00 O clock and deployment starts at 2:55 and ends at 3:05. What will happen to that triggered pipeline which was supposed to run at 3:00?
Any one having a clear idea about above questions or Is there any documentation for reference to obtain answers for these questions?
I have gone through Keeping deployment mode as Incremental instead of keeping it as Complete at the time of ARM template deployment. Will that option do all the tasks which I asked above?
How the changes are deployed from DevOps to PROD environment? Will it delete and replace all the pipelines and triggers from DevOps or It will pick only the changes and update the PROD env without touching the unchanged pipelines?
It depends on the deployment mode you choose.
Deployment Mode: This specifies the deployment mode in which the Azure resources specified in the template have to be deployed.
Incremental mode handles deployments as incremental updates to the
resource group . It leaves unchanged resources that exist in the
resource group but are not specified in the template. Complete mode
deletes resources that are not in your template. Validate mode
enables you to find syntactical problems with the template before
creating actual resources. By default, incremental mode is used.
Suppose a pipeline is running in PROD env at the time of deployment,
what will happen to that pipeline run?
Your deployment will fail, and you may receive a 409 conflict error message. You could check the document Best practices for CI/CD:
Pre- and post-deployment script. Before the Resource Manager
deployment step in CI/CD, you need to complete certain tasks, like
stopping and restarting triggers and performing cleanup. We recommend
that you use PowerShell scripts before and after the deployment task.
For more information, see Update active triggers. The data factory
team has provided a script to use located at the bottom of this page.
Suppose there is a triggered pipeline at 3:00 O clock and deployment
starts at 2:55 and ends at 3:05. What will happen to that triggered
pipeline which was supposed to run at 3:00?
Similar to your second question, the pipeline should not be triggered (or in the pending state), but I still don't have an instance to test such a scenario.

Azure DevOps CI/CD - Angular Project - nodeJS

AzureDevOps Pipeline
Hi, I'm about to do CI and CD for my angular project which is in Azure DevOps Repo.
i"m new to this and referring lots of documentation, i'm still not able to do.
Can some one help to with the step by step procedure ( videos if any) to the below listed pipeline tasks,
1) Pipeline,
2) Environments, 3) Releases
4) Library
5) Task Group
6) Deployment Groups.
Thanks in advance.
1)Pipeline
There're two formats of Azure Devops pipelines: Classic(UI) pipelines and Yaml pipelines.
They have different feature abilities. We can create Classic Build pipelines or multistage Yaml pipelines here.
2)Environments
The Environments represent a collection of resources targeted for deployment. It's used mostly for CD and it's not available in Classic pipelines, only available in Yaml pipeline.
3) Releases
We can create and manage Classic Release pipelines here. Mostly for CD.
4) Library
We can use this option to manage some variables group. Normally we can define pipeline variables, but those variables are not valid in another new pipeline. To reuse some common variables(Share variables across pipelines), we can consider using Variable Groups under Library.
5) Task Group
Similar to Variable Group under Library, it's used to reuse Tasks. If we have many pipelines in which use some similar tasks, we don't need to define the tasks one-by-one each time with Task Groups. See Create a Task Group.
6) Deployment Groups
Check its corresponding document here:
A deployment group is a logical set of deployment target machines that have agents installed on each one. Deployment groups represent the physical environments; for example, "Dev", "Test", "UAT", and "Production". In effect, a deployment group is just another grouping of agents, much like an agent pool.
Note: The Deployment Groups in your picture is only supported for Classic Release Pipeline, not yaml pipeline.
I'm about to do CI and CD for my angular project which is in Azure
DevOps Repo.
You don't need to know all the options above when you're new to Azure Devops. A quick-start about Angular project see here:
1.Build your angular project. It could be a simple script like this:
- script: |
npm install -g #angular/cli
npm install
ng build --prod
2.To deploy it, you can consider using Azure Web App Deploy Task.
Here's one detailed description about that from r3plica. You can easily turn it into classic UI format by using tasks with same names.

How to create app services for feature branches dynamically in Azure DevOps

I'm working on an API in core3.1. We have a build pipeline that builds and unit tests any change for any branch. And release pipelines for development and master branches. These deploy to designated app services in Azure.
Now we would like a release pipeline for feature branches. So what we want is a pipeline that can dynamically created app-services per feature branch and deploy to that app service. And preferably dynamically delete the app-service when the branch is deleted.
Just to clarify, the proces how we would like it:
a developer creates feature branch and pushes it >
the build pipeline builds it >
an app service gets created automatically >
stuff gets deployed to that app service >
developers work on the branch and changes get build and deployed to the app service like normal >
at some later point a developer deletes branch >
app service gets deleted automaticcaly
Is there any way to accomplish this? Maybe there is a standard way?
Feature branches are located in a subfolder, e.g. "feat/feature-branch-name".
I'm fairly new to Azure and DevOps.
Any help is appriciated. Thanks in advance.
You should follow the practice of Infrastructure as Code (IaC) and use ARM templates in your pipeline to create/update/delete your Azure resources. You can also use the built-in tasks available in Azure DevOps to deploy your ARM templates.

selection of task in release pipeline in azure devops

I have a build pipeline which I created and I have the artifacts in a drop folder.
Now I want to deploy these artifacts. The drop folder contains my data factory resources like pipelines, datasets.
I have 2 questions:
What task for the agent should I select in the release pipeline to deploy this folder?
How do I specify that in this environment it should go ? i.e. If I suppose have a QA environment, then how do I specify that thing?
I am actually confused over this selection of task for the agent.
What task for the agent should I select in the release pipeline to
deploy this folder?
It's based on where and how you want to deploy the artifacts.
If you just want to deploy them in a local machine where you can access, then you just need to add a Copy Files task to copy the artifacts to the target folder.
If you want to deploy to other remote sites or third party services, then you need to select other tasks based on your requirements, and some of them we need to create services connections to access them.
For example Deploy to Azure(e.g. Deploy a web app to Azure App Services)
How do I specify that in this environment it should go ? i.e. If I
suppose have a QA environment, then how do I specify that thing?
In release pipeline we can defined multiple environments/stages, in each environment we can add different tasks to do the actions based on our requirements. We need to add the artifacts sources to deploy them in the release pipeline. Please see Release pipelines for details. You can reference below links to do that:
Reference Exercise 2: Examine the CI/CD pipelines configured by
Azure DevOps Project
Azure DevOps - creating a release pipeline- Video Guide

Resources