Back to Top

Managing build and deployment pipelines for projects in a Git repository

BuildMaster is an application release automation tool. In this tutorial, we'll be building a Build Artifact within BuildMaster using an outside repository. In this case, we'll be using GitHub as our repository for an application called Accounts.

If you'd like to follow along step-by-step, you can use a personal project repository. For this tutorial, we will call this repository Accounts.


Git Installation and Setup

 

Step 1: Install and Configure Extensions

Go to the Administration page by clicking the gear symbol in the upper left-hand corner and then click the on Extensions.

For this tutorial we will be installing the Git extension. Scroll down the extensions page and install the extension.

After the extensions are installed, BuildMaster will automatically restart, and the Git plugin will now be in the Up-to-Date Extensions.

Back on the Admin page, click Resource Credentials, and then click the Create Credential button. A window will pop up, asking you to select a credential type, select Git.

We'll create a Git resource credential by filling out appropriate fields like Repository URL, User name and Password.

 

Step 2: Create an Application

Click on Applications, then click the Create Application button. This will bring up a window, where you will set the name to Accounts. When creating the application, the Integration, Testing, and Production environments will be added by default as the initial pipeline. When finished, click Create.

 

Step 3: Edit Deployment Plan

Go to the Plans tab, then click on Deploy Accounts.

BuildMaster has automatically created a simple deployment plan by default. The plan doesn't do much, but we can edit it so that it will deploy the artifact that we'll import through the pipeline.

Edit the General Block at the top with a short description of what the plan will do and set a server for the plan to be run on. Note that you can also target environments and servers to execute operations on from the pipeline stage, but for this tutorial, we'll just set it here.

The two default actions in the plan can be deleted and we will replace them by dragging a Deploy Artifact operation into the edited General Block. Set the Artifact name to Websites, and the Target directory to C:\Websites\$EnvironmentName\Accounts. Using $EnvironmentName will create a new folder for each environment that the application is deployed to and demonstrates one way to generalize a deployment plan for use in multiple environments.

 

Step 4: Create a New Build Plan

Create a plan by clicking the Create Plan button and name the plan Build Accounts Website.

First, add a General Block with a short description, like "Build Accounts Website."

Next, we'll add a Get Source from Git Repository operation that will pull the latest files from a Git repository and store them in a temporary workspace called $WorkingDirectory. We'll use the Git resource credential we've already created.

We should capture the GitCommit into a release variable similar to the TFS build number.

Let's also store the commit ID into a variable. This can be done on the Advanced tab of this operation.

Now, we'll add a Set Release Variable operation, where you can add a build variable name and value. For this project we will just be setting the value to commitID (where the commit hash was previously stored) in order to store the commit ID within this release variable.

You can also add a tag to the most recent commit ID by adding a Tag Git Source operation.

Now we are prepared to build our Accounts web application simply by adding a Build MSBuild Project. Here you can specify a project or solution file, configuration and target directory.

To turn this build into an Artifact, add a Create Artifact operation. Name the artifact "Websites" because that is the artifact that we used in the deployment plan we first created.

If done correctly the plan will look like the image below:

And in text mode:

 

Step 5: Edit Application Pipeline and Set Build Plan

When we created the application, a simple pipeline was also created which we can now edit. Click on Accounts and then click on the Pipelines tab. Finally click on the Add Stage button.

Set Name to Build, then set Pipeline position to 0 and Click Save Stage.

We'll add a target to the Build stage using our build plan (Build Accounts) and our local server.

 

Step 6: Creating a Release and Deploying

After setting the build target, we will create a Release that builds and deploys this artifact. The release number can be anything, but defaults to 0.0.0.

Click on Releases then click Create Release. After this, you can click the Create Package button.

BuildMaster will now run the build plan we've set up and create the artifact. We can see that there has been an artifact created called Websites.

You can now run the artifact through the rest of the pipeline simply by clicking Deploy in each successive stage. Of course, you can also configure gates, listeners, or permissions to ensure that a proper process is followed.

You can further verify that the deployment was successful by checking the drive used when setting up the deployment plan. There will be three folders under /Website -one for Integration, Testing, and Production, all with the deployed files.