Back to Top

BuildMaster GitLab 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 GitLab 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.


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

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

We'll create a GitLab resource credential by filling out appropriate fields like Name, Project, User name and Personal access token.

Note: The GitLab API requires that the user sets up a form of authentication in order to establish API access. More info on setting this up can be found here: https://docs.gitlab.com/ee/api/#authentication

 

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 GitLab as an Issue Source

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

Next, click on GitLab 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 GitLab 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 GitLab Account.

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

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

Before saving this operation, let's specify the project name. This can be done by selecting the directory through a drop-down menu of choices within the GitLab 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. 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.

Lastly, we will use the Tag GitLab Source operation. We will specify the credentials as well as a name for the tag.

Again, before saving let's specify the project name. This can be done by selecting the directory through a drop-down menu of choices within the GitLab 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.

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 (GitLab Operations) 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.