Automated Builds – Part 1: Introduction

Last few days I have been working on running automated builds for Business Central on our self-hosted server using Azure DevOps.

There are already few articles in the Internet where you can read about it. You can find the good series of posts on https://freddysblog.com/ or https://jpearson.blog/. Lately also DevOps for AL extension had been released. More information here: http://www.waldo.be/2019/06/18/devops-for-al-alops-is-alive/

Despite those blogs I decided to share all of my findings and scripts with you.

What you would find on the blog

In the next few articles, starting from this one, you will be able to get more info about:

  1. How to setup the self-hosted agent and connect it with your Azure DevOps
  2. How to create a build pipeline using YAML files
  3. How to create the Docker Container for your builds
  4. How to compile and publish single extension
  5. How to get more than one extension from multiple repositories and install them on the created Docker Container
  6. How to get extension for automated tests and run it automatically in the created Docker Container
  7. How to publish automated tests results on Azure DevOps
  8. How to create a release pipeline after a successful build

Few words before start

First of all, I should say that in all my examples, which I will present, I am using NAVContainerHelper. I really like them and fully support the idea. The library is easy to use and really useful. I know that there are some inconvenience using them, but I decided to base my workflow on using them anyway.

Second of all, to start you need to have few things ready:

  1. Installed docker (only it) on your server where you would like to do builds. For training you can use even your laptop
  2. Created Azure DevOps account and the project with at least one GIT repository which has the Business Central application. However, if you want to have more complex examples you can have more than one repository and also at least one repository for the automated tests.

How the workflow will look like at the end?

In fact, after series of my articles you will have information how to build one of 4 options.

Single Extension flow

This is the simplest option. It will have below steps:

  1. Receive files from the repository
  2. Install latest version of NAVContainerHelper
  3. Create docker container from requested image
  4. Copy additional files to the container (only if necessary)
  5. Compile extension in the docker container
  6. Publish extension in the docker container

Single Extension flow with automated tests

This is the extension to the previous workflow. After publishing the extension, next steps will be processed:

  1. Receive files from the repository where the extension with automated tests is stored
  2. Compile and publish the testing extension
  3. Run automated tests in the docker container
  4. Publish the results on Azure DevOps

Multiple Extensions flow

This is the more complex example. After following this path, you will be able to build your whole project if it contains more than one extension. It is quite common approach for products which have modules. The workflow for this example looks as follows:

  1. Receive files from the main repository
  2. Install latest version of NAVContainerHelper
  3. Create docker container from requested image
  4. Copy additional files to the container (only if necessary)

After those steps there are few more which are going in the loop for each extension:

  1. Receive files from the repository for the extension
  2. Compile extension in the container
  3. Publish extension in the container

Multiple Extension flow with automated tests

This is the extension to the previous workflow again. After publishing all required extensions, next steps will be done related to the test applications:

  1. Receive files from the repository or more repositories where the extension with automated tests is stored
  2. Compile and publish the testing extension
  3. Run automated tests in the docker container
  4. Publish the results on Azure DevOps

Hope you will enjoy the series on the blog.

Add a Comment

Your email address will not be published. Required fields are marked *