Today’s post is conceptually a rather simple one… Let’s see how we can go from this ;
To here ;
By using a CI/CD pipeline.
Flow of the day
What will we be doing today?
- Kick-off a VSTS build once a change has been made to our Github repo
- Build a container via VSTS
- Publish the container to an ACR (Azure Container Registry)
- Kick-off a VSTS release once the build succeeded
- Use an ARM template to deploy an ACI (Azure Container Instance) with our docker container underneath
Sound cool? Let’s get to it!
Let’s take a look at our build flow… So we’ll start by trigger. We’ve enabled “Continuous Integration” and trigger the build flow upon every change made to our repository.
The first step will be to retrieve the sources from our repo ;
Next we’ll build the image ;
This can be done by a default VSTS task ;
Likewise for the task that publishes the newly build container to the ACR ;
For both steps we used a “Docker Host Connection” ;
Now what is that “Docker Host Connection”. Basically a host with docker installed upon it, which can be reached by the VSTS build agent. Looking what to provide in the following configuration … Check out this page.
Now if the build succeeded, then we can kick off our release flow. As an input we’ll be using the “build artifact” as trigger for our “Continuous deployment” ;
These tokens have been configured in the “Variables” section of our build ;
Which then will be used for the “tokenization” of our parameters file. Basically, each token will be used to do a lookup in the variables name, and then replace by the relative value.
As you might have noticed, the “image”-variable includes the build number. This build number was used as a tag for the image in the registry ;
Now let’s use the template & parameter file to do the deployment ;
CI/CD Demo Flow
So let’s see how that all ties together… First the build kicks in ;
Afterwards our release ;
Which created a resource group with an ACI inside ;
The ACI is running nicely…
And published to the outside world!
All done! Whoot. 😀