"post": {
"title": "Running Gitlab CI Runner in GCE",
"date": "22 September 2016",
"content": "

Earlier this week I decided to give the Gitlab CI a shot and started to look into how to set up a cluster of Docker containers to handle all the tests.

After a lot of trial and error and hours of frustration (~20h), I finally came up with a combination that seemed to work pretty reliably.

Now I want to share this combination for anyone to use, so they don't have to spend those frustrating hours (hopefully) in debugging weirdness in combination of Gitlab Multi Runner, Docker Machine and GCE.

The full setup and instructions on how to setup this auto-scaling infrastructure can be found in my Github repo https://github.com/jerryjj/gitlab-runner-gce.

In a nutshell this setup will do the following:
1. Setup a NAT-gateway in the GCP project for the workers to use
2. Setup a g1-small instance to act as a Gitlab Runner
3. Register this runner to your Gitlab instance
4. Configure Docker Machine to spin up g1-small Preemptible VMs as the workers.

In idle-state this configuration costs approx. $20USD/month.

After the setup is finished and the cluster is stable, using it is really simple.
In example for a Node.js project you could write a file like this and name it ".gitlab-ci-yml" and push it to your repository

image: node:6

  - node_modules/

  stage: test
   - npm install
   - npm test
  - backend

And just like that, your Runner Cluster steps in and starts working for you.

"tags": [...],
"author": {
"name": "Jerry Jalava",
"share": [...],
"follow": [
"copyright": "TotallyOnMe © 2018"