DevOps for Japan

BuildMaster GitHub Operations Tutorial

BuildMaster is an application release automation tool. In this tutorial, we'll be putting together a setup that shows how to use various GitHub operations within BuildMaster.

If you'd like to follow along step-by-step, you can use a personal project repository. For this tutorial, we will be using a repository called Accounts that was created just for testing purposes.

GitHub 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 GitHub extension. Scroll down the extensions page and install the extension.

After the extensions are installed, BuildMaster will automatically restart, and the GitHub 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 GitHub.

We'll create a GitHub resource credential by filling out appropriate fields like Name, 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: Setting up GitHub as an Issue Source

Now that the Accounts application has been created, we can set GitHub as an issue source for BuildMaster by going to the Administration page. Click on Issue Sources from this page.

Next, click on GitHub Issue Source.

From here we are able to enter a Source name, set to run for the Accounts application and also set the Credentials to the GitHub resource credentials that we set up earlier. When finished, click Save Issue Source.

Step 4: Create a New Build Plan

Create a plan by clicking the Create Plan button and name the plan GitHub Account.

First, add a General Block and keep the default settings. Feel free to add a short description, like "GitHub Operations".

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

Before saving this operation, let's specify the repository name. This can be done by selecting the directory through a drop-down menu of choices within the GitHub tab.

Let's also store the commit ID into a variable. This can be done in the Advanced tab of this operation. For this project, we will just name this variable as $commitID.

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.

Next, we will use the Upload GitHub Release Assets operation. Specify the Credentials field with the GitHub credentials we created previously. A Tag name for the release must also be specified, so we will just use newRelease as the tag name. The Includes field allows you to specify which assets you would like to upload and the Excludes field allows you to exclude any files to upload from the working directory. Here we will just include all files in the working directory by adding an asterisk (*) to the Includes field.

Again, before saving this operation, let's also specify the repository. This can be done by selecting the directory through a drop-down menu of choices within the GitHub tab.

The last operation we will add to the plan will be the Set GitHub Build Status operation. We will fill in the same GitHub credentials for the credentials field, set the Git commit hash to $commitID and set the status to success.

Don't forget to also specify the repository name in the GitHub tab as we did with previous operations.

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 (GitHub Account) 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 plan. 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 allow you to view any details of the process.

From here we can run the rest of the pipeline simply by clicking Deploy in each successive stage.

You can further verify that the deployment was successful by checking the drive used when setting up the deployment plan.