Copyright & Register Trademark by Ortus Solutions, Corp & Ortus Software, LLC
Gitlab is one of the most popular collaboration software suites around. It is not only a CI server, but a source code server, docker registry, issue manager, and much much more. They are our personal favorite for private projects due to their power and flexibility.
All in one tool: CI, repository, docker registry, issues/milestones, etc.
Same as Travis in concept - CI Runner
Docker based
CI Runners can be decoupled to a docker swarm
Idea of CI pipelines
Pipelines composed of jobs executed in stages
Jobs can have dependencies, artifacts, services, etc
Schedule Pipelines (Cron)
Jobs can track environments
Great stats + charting
In order to work with Gitlab you must create a .gitlab-ci.yml
file in the root of your project. Once there are commits in your repository, Gitlab will process this file as your build file. Please refer to the Gitlab Pipelines documentation for further study.
We will leverage the Ortus Solutions CommandBox Docker image in order to provide us with the capability to run any CFML engine and to execute tests. Please note that Gitlab runs in a docker environment.
The build file above leverages the ortussolutions/commandbox:alpine
image, which is a compact and secure image for CommandBox. We then have a few stages (build,test,deploy), but let's focus on the run_tests
job.
We define which branches it should listen to: development
, and then we have a script
block that defines what to do for this job. Please note that the when
action is commented, because we want to execute this job every time there is a commit. In Gitlab we can determine if a job is manual, scheduled, automatic or dependent on other jobs, which is one of the most flexible execution runners around.
In our script we basically install our dependencies for our project using CommandBox and startup a CFML server. We then go ahead and execute our tests via box testbox run
.
In order for the box testbox run
to execute correctly, our box.json
in our project must be able to connect to our server and know which tests to execute. Below are all the possiblities for the testbox
integration object in CommandBox's box.json
. (See the CommandBox docs for box.json for more details.)
You can look at our cbVue
sample application online: https://gitlab.com/lmajano/cbvue which contains all CI server integrations.