Azure DevOps CI/CD - Angular Project - nodeJS - node.js

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.

Related

How do I version control Azure ML workspaces with custom environments and pipelines?

I'm trying to figure out how viable Azure ML in production; I would like to accomplish the following:
Specify custom environments for my pipelines using a pip file and use them in a pipeline
Declaratively specify my workspace, environments and pipelines in an Azure DevOps repo
Reproducibly deploy my Azure ML workspace to my subscription using an Azure DevOps pipeline
I found an explanation of how to specify environments using notebooks but this seems ill-suited for the second and third requirements I have.
Currently, we have a python script, pipeline.py that uses the azureml-sdkto create, register and run all of our ML artifacts (envs, pipelines, models). We call this script in our Azure DevOps CI pipeline with a Python Script task after building the right pip env from the requirements file in our repo.
However, it is worth noting there is YAML support for ML artifact definition. Though I don't know if the existing support will cover all of your bases (though that is the plan).
Here's some great docs from MSFT to get you started:
GitHub Template repo of an end-to-end example of ML pipeline + deployment
How to define/create an environment (using Pip or Conda) and use it in a remote compute context
Azure Pipelines guidance on CI/CD for ML Service
Defining ML pipelines in YAML

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

How to deploy python flask application on linux web app service through azure portal?

I am trying to deploy my flask application on Linux web apps.
I want to set a azure pipeline for my code which is pushed on an azure repository.
I have made all the configuration changes in my python code and created a web app with runtime stack of Python 3.7
As soon as I go to deployment center to deploy my code, after selecting the azure repository as the source of my code, I am redirected to an option of azure pipelines where we have to configure our build settings.
But the build does not gives any option for Python. It just gives me four build options such as Node, Ruby, Asp.Net and php.
I cannot use :
- Docker
- Git
With such limitations I have found no suitable tutorial to do the same.
Can someone tell me some way to set the pipeline for my python project ?
Azure DevOps CI/CD works with any language, platform and cloud. Just for Python application, you may need add additional steps to achieve the deployment from Azure Devops CI/CD.
CI
Since the python is an interpreted language, do not need the compilation. If none of other step, like test, just need use 2 tasks in CI pipeline: Archive Files task and Publish Build Artifacts task.
The Archive Files task used to pack the python application source folder into a zip package to use it in CD. And Publish Build Artifacts task will publish this zip package to Release pipeline.
BUT,
If your project contains and needs test, please add another Command line task to run the test by using pytest.
But, in azure devops, you need configure the python environment with some tasks if you want to use python component like pytest.
Here please refer to this blog.
Note: Since the stack you are using is Python 3.7, please specify the python version as 3.x in the Using Python task.
CD
Since you have create the app service in Azure portal, just skip step 4(Add Azure CLI task) in Exercise 3: Configure Release pipeline which shown in this blog, because Step 4 just used to create a new Azure Resources.
1. To deploy the python application, you need add the Azure App Service manage task first to install the corresponding python version site extension in release pipeline:
It would install set of corresponding tools to support to manage your app service.
2. Next you could use Azure App Service deploy to deploy the zip package which created in the Build pipeline, to the app service you configured in Azure portal.
After specified the subscription in this task, the app service will automatically display in the drop list of App Service name:
Then specified the path which you configured in the publish task of the build pipeline. Replace $(Build.ArtifactStagingDirectory) as $(System.DefaultWorkingDirectory), and replace $(Build.BuildId) as * to search the zip package by using the fuzzy search.

Start ARM template deploy conditionally in Azure Devops

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.

Resources