Read Part I here: https://impelos.com/continuous-deploy-with-commandbox/

Why Gitlab?

Gitlab allows us to host our own version control system without being subject to the whims of external parties. DigitalOcean does a wonderful job of serving it up for us.

Commandbox to Gitlab API

We’ll be using a CommandBox task runner to apply a version tag to the master branch.

First, we need an array of all of the repository project IDs associated with our project. You can find the project ID under the project’s name in “Project Details” view. We use a struct of arrays so they can be referenced by name later. It’s a constant, so we define it at the beginning of our gitlab task runner.

this.projList = { 'impelos' = [21, 202, 198, ... ] };
this.privateToken = 'privateTokenFromGitlab';

After validating the arguments, the function iterates through all of the projects in the array

  • Validate the project ID, and its master branch
  • Creates a new tag from the arguments
    Gitlab rather nicely checks for an existing tag and returns an appropriate status_code
  • Report back with any codes that might indicate a problem
  • Validates that the tag was created successfully

Here’s how I normally call this function:

box task run gitlab.cfc createTag impelos "1.2.6+4" "Some tale about this build"

You can see the component in its entirety in this gist.

Now that we’ve got the same version set across projects, we can run our continuousDeploy task runner for the first time. Coming soon…