Part 1 Azure DevOps: Setting up a Repo and Creating a Build Pipeline

Welcome to Azure Devops! Azure DevOps can be a one-stop-shop platform for managing source code for applications. Here you can store your code, create automation pipelines, and deploy applications. In addition, you can run automated tests, and much more.

If this is your first time using Azure DevOps or want a refresher, this series of tutorials is for you. In brief, I’ll get you onboard the CI/CD process. To start with, you’ll learn how to create a repo for your code, where other developers can access it and make changes to it. By creating a build pipeline, you’ll be able to start the process of using CI/CD. This allows development teams to increase their working efficiency. This is through taking many of the manual tasks and having them automated.

In this series, you’ll create a repo and a YAML build pipeline first. Next, you’ll establish a release pipeline. Finally, you’ll be setting up quality assurance (QA) testing. These pipelines will be simple and get you familiar with the basics.

First, what is a repo?

What’s a Repo?

repository or ‘repo’, is a centralized location where your application’s source code lives. This allows developers to make changes to it using version control tools, like Git or Azure DevOps.

Some management tools, like Git, enable both private and public collaborations. This is especially useful for both larger open-source projects and proprietary development. That said, Azure DevOps gives you formal support offerings, a plus in a business setting.

If you don’t use a repo, you’ll have difficulty organizing even smaller team projects. In essence, duplication occurs along with teams working on obsolete code. To stop these problems in your development process you must use a repo.

Let’s now dive into creating your first repo and linking it to a build pipeline.

Creating Your First Repo

The first thing you’ll do is create a new repo:

  1. Click repos on the left-hand menu.
  2. Go to the dashboard and select repos. A list of repos that are in your project will appear.
  3. Go to the bottom of the drop-down and select new repository.
  4. Once you click new repository, you’ll get a dialog box that asks what kind of repo you want–either Git or TFVC. Often, you’ll want to create a git repo unless your team lead directs you differently.
  5. Name your repo. In this case, you can call it ‘Test’, but you’ll want to follow your company’s naming conventions.
Screenshot of Azure DevOps showing the repos menu. Highlighted in a red outline is where to click to create a new repo.
Click “New repository” to get started!
Screenshot of "create a repository" dialog box. Here you will be able to choose your version control system and name your repo.
Remember to name your repo something that follows your company’s naming conventions.

Once you click create at the bottom of the dialogue box you’re taken to your newly created repo. This is empty except for the automatically generated readme file and a Git ignore file if you chose to include one.

You’ve now successfully created a repo in Azure DevOps. Now for the next step, let’s create a build pipeline to go with this repo.

Create a Build Pipeline

Now that you have created your first repo, you’ll need to create a build pipeline. A build pipeline is going to take all the manual tasks that you need to compile and run your code.

The Compiled Program

This build pipeline will create an artifact; this is your compiled program. In general, this artifact will only be useful in your release pipeline. I’ll talk more about release pipelines in the next article.

Step 1: Creating the Build Pipeline

The first step to creating your build pipeline is quite simple. Right now, you should still be on your newly created repo. At the very top of the page, you should see a blue button that says “set up build”. Click it and this will take you to the next step.

Screenshot showing the top of the newly created repo, with the options to "set up build" and "clone".
Click “set up build” to create you first build pipeline!

Step 2: Configuring the Build Pipeline

In this step, you configure your pipeline. At this stage, you have two main options that are most commonly used. The “Starter pipeline” will provide you with a boilerplate YAML pipeline to get you started. For this tutorial, you’ll use this option for its setup convenience. Before we move on, though, it’s important to go over a few of the options provided with this option.

Screenshot showing the pipeline configuration page, your options are to create a starter pipeline, use an existing Azure pipelines yaml file or browse the many other options.
Click “starter pipeline” to get started!

If you already have YAML pipelines, you can click on the second option “Existing Azure Pipelines YAML file”. This will allow you to import your pipelines or templates.

Bestseller No. 1
Mybaby Automatic Soap Dispenser, 1.1 Pound
  • Works With All Liquid Hand Soaps
  • Plays 20 Second Song That Teaches Children How To...
  • Motion Sensor Technology Provides Sanitary,...
  • Magnetically Attached Drip Tray Removes Easily For...
  • Self-cleaning Function Prevents Clogs And Mess
SaleBestseller No. 2
Asterom Walking Cane - Handmade Wolf Cane - Cool Walking Canes for Men and Women - Wooden, Carved, Unique - Walking Sticks for Men & Seniors (36 Inch)
  • STYLISH CANE FROM THE RED CARPET TO YOUR HOME! Our...
  • 100% SATISFACTION GUARANTEED! Buy with confidence,...
  • EXCEPTIONAL COMFORT DUE TO ERGONOMIC HANDLE. The...
  • CHOOSE THE CORRECT LENGTH TO AVOID SPINE PAIN....
  • WIDE QUAD CANE TIP COMPATIBLE. Need extra...

If you click “show more”, you’ll have a long list of pipeline options that include: .NET, ASP.NET, C, C++, DockerKubernetes service, Go, Gradle, HTML, Python, etc.

Step 3: Running the Build Pipeline

Once you click on “starter pipeline” you’ll get a YAML file with your starter pipeline as shown in the screenshot below.

Screen shot showing the yaml starter pipeline code.
You just created your first yaml build pipeline; congrats!

When you click “save and run” you’ll need to make a commit to push to master to get your pipeline added. Once you do that you can run it; it’s that simple.

Now, let’s walk through the key “steps” you can change so you can optimize your YAML.

YAML Walkthrough 

YAML allows you to add or change steps to optimize your workflow. In this section, I’ll provide you with the key steps you need to know. Firstly, let’s go through one of the most important ones.

Trigger

This is what kicks off the pipeline’s workflow. The trigger is set to master in this example. Whenever a pull request (PR) is made to master, this pipeline will run.

Pool

Another useful step is “Pool”. This can be filled with many functions such as vmImage and pipeline agents. In this example, it’s pulling a base image for the latest Ubuntu operating system.

Steps in General

New
Rose Quartz Agate | Serving Tray with Brass Handles | Circular (Gold - Finish), Diameter(12 inch)
  • The natural look of agate stone creates a unique...
  • The edges of each piece are electroplated (NOT...
  • Handles are solid brass.
  • Available in 12", 14" and 16" diameter
  • Can do silver, rose gold, or gold plating for...
New
AANTHROPOLOGY By Rhea White Crystal Agate Cheese Platter/Tray | Circular (Gold - Finish), Diameter(12 inches)
  • The natural look of agate stone creates a unique...
  • The edges of each piece are electroplated (NOT...
  • Handles are solid brass.
  • Available in 12", 14" and 16" diameter
  • Can do silver, rose gold, or gold plating for...
New
Magenta Agate Aventurine Set of 4 Large Coasters/Sign Boards (Rose Gold - Finish)
  • Sold as a set of 4 pieces
  • 4" x 4"
  • 10 - 12 mm thick
  • Natural stone will vary in size, color, and...
  • Each piece has 4 rubber pads to avoid scratching...

Above all else, you need to remember that “Steps” are the tasks the pipeline will execute. For example, the first script in this example will print “Hello World”. The “displayname” is the name of the task. You can see display names or task names in the console as the pipeline runs. The second script will print a message and a link to follow.

In this example, you can see how simple pipelines and steps are. So, congratulations! Now you can set up pipelines. This will be useful for all Azure DevOps you create in the future.

Final Words

In this tutorial, you created your first repo and set up a build pipeline. This also allows you to create your project and automate any manual tasks. In addition, you became more familiar with YAML and how to read the code which makes up your pipeline.

Original Post>