How to set up CI/CD with Buddy and Azure
The following article will help you set up Continuous Deployment to Azure using Buddy. Upon reading this guide you will be able to:
- Initialize Continuous Deployment on Microsoft Azure
- Create a pipeline in Buddy that will deliver your .NET app to Azure
- Configure Buddy to test your app before deployment
The problems of modern web development
Usually, developers write, compile and test code locally and then manually upload the package to the server. However, once the project grows bigger and more developers start to participate, problems begin to appear:
- Deployment preparation is getting more time-consuming as more time is needed for preparation.
- Software iteration is getting longer with every release, which results in less feedback from the client.
- Testing is more difficult as every team member has their own development environment.
- Team members need to communicate more often, increasing the risk of communication errors.
How CI/CD helps developers solve these problems
The issues above can be successfully addressed by introducing a build server and deployment automation to your workflow.
- The software is built and tested in one consistent environment, avoiding dependencies on local dev boxes.
- You save time on setting up builds, installing the required software, etc.
- Having one centralized build server provides easy access to code metrics, making it easier to properly cover your code with tests.
- Automatic deployments allow you to release software and receive feedback more often with the whole process simplified to a minimum.
As you can see, these are some serious advantages one shouldn't reject easily. The following guide will tell how to use Buddy to apply Continuous Deployment to your projects so you can benefit from all of the above.
Step 1: Synchronizing Git repository
Before you apply the Continuous approach to your workflow, we need to start with the basics: putting your files under version control. We firmly believe this is a standard practice in web development companies by now, but it's never enough to stress how important it is. In this example we shall use a preconfigured .NET sample project hosted on GitHub:
Selecting Git provider
You can also use Bitbucket, GitLab, any type of a custom repository, or Buddy's fully featured Git hosting with code editor, branch management and merge requests.
Step 2: Setting up Azure
Let's automate your workflow in a way that every time you make a push to a branch Buddy will deploy your project. First, we need to set a couple of things in Azure:
- Sign in to https://portal.azure.com
- Go to your web app's blade and click Overview. There will be a Get publish profile link on the top. Click it to download an XML file with the publishing data.
- Then, copy
Git clone urlto use it in the next step.
Step 3: Configuring Deployment in Buddy
Now, we need to create a pipeline that will push your files to the Azure repository. Pipelines in Buddy consist of actions arranged in a sequence and triggered on a push to a branch. Let's create a pipeline for Azure:
- Add a new pipeline, set the trigger mode to On every push and assign it to the Master branch. This way the pipeline will be executed automatically on every push to Master:
You can also set the trigger mode to manual or recurrent if you don't want to update the Master so often. Read more about setting pipeline details.
Select the Azure App Service action and paste the following values from the downloaded XML file:
Paste the URL copied in the previous step in the
Make sure to provide the data from the publish profile with
Click Add this action to finish configuration.
From now on Buddy will deploy your project to Microsoft Azure every time you make a push to Master in your repository.
But are we sure the code that you send is properly verified for errors?
Step 4: Testing application before deployment
One of the basic rules of the Continuous approach is to make sure your code is thoroughly tested before deploying it to the server. With Buddy, you can do that by running tests in pre-defined Linux containers that represent your developer environment. Since our project is a C# website, we shall use Mono, a cross-platform .NET framework:
- On the action manager view click plus above Azure and select the .NET Framework action.
You can create .NET Core projects in Buddy as well.
By default, the following commands are executed:
nuget restore msbuild /p:Configuration=Release /p:DebugSymbols=false /p:TargetFrameworkVersion="v4.7"$$
The first command downloads any packages missing from the packages folder. The second command builds the whole solution. 4.7 is the version of your .NET framework.
- Click Add this action to save changes.
- Run the pipeline to see if everything works.
Customer Success Manager
With Buddy even the most complicated CI/CD workflows take minutes to create
Sign up for Buddy CI/CDStart a free trial
Trusted by customers from 170+ countries