Gitlab-runner docs examples

Example deploy & scaling

This example show a basic deploy scaling to N runners.

Create a file with your configuration: runner-config.yaml:

gitlab-runner:
  gitlab-server: "https://gitlab.example.com"
  gitlab-registration-token: tXwQuDAVmzxzzTtw2-ZL
  tag-list: "juju,docker,master"
  run-untagged: true

Then deploy with your config and some instance constraints.

  juju deploy --constraints="mem=4G cores=2" ./builds/gitlab-runner --config runner-config.yaml

Scale up your deployment with ‘juju add-unit’ and you will get an identical new instance. serving your pipeline:

  juju add-unit gitlab-runner

Scale down with ‘juju remove-unit’ (will also unregister the instance in gitlab)

  juju remove-unit gitlab-runner/0

Example deploy, multiple projects, different sizes

Create two files with your separate configurations.

runner-config-one.yaml

gitlab-runner-one:
  gitlab-server: "https://gitlab.example.com"
  gitlab-registration-token: rXwQugergrzxzz32Fw3-44
  tag-list: "juju,docker,master"
  run-untagged: true

runner-config-two.yaml

gitlab-runner-two:
  gitlab-server: "https://gitlab.example.com"
  gitlab-registration-token: tXwQuDAVmzxzzTtw2-ZL
  tag-list: "juju,docker,daily"
  run-untagged: true

Deploy the same charm, using two differnt configs and different constraints.

  juju deploy --constraints="mem=4G cores=2" ./builds/gitlab-runner gitlab-runner-one --config runner-config-one.yaml
  juju deploy --constraints="mem=2G cores=1" ./builds/gitlab-runner gitlab-runner-two --config runner-config-two.yaml

Example deploy, relate to prometheus for monitoring

With any of the other examples, add in a prometheus instance:

  juju deploy prometheus2 --constraints="mem=4G cores=2"
  juju relate prometheus2 gitlab-runner
  juju expose prometheus2

When ready, the prometheus instance will be available on http://prometheus-instance:9090/

Deploy gitlab-runner with prometheus and grafana

juju deploy --constraints="mem=4G cores=2" ./builds/gitlab-runner --config runner-config.yaml
juju deploy prometheus2 --constraints="mem=4G cores=2"
juju deploy grafana
juju relate prometheus2 gitlab-runner
juju add-relation prometheus2:grafana-source grafana:grafana-source
juju expose prometheus2
juju expose grafana

# Get the admin password to login to grafana.
juju run-action --wait grafana/0 get-admin-password

Browse to http://grafana:3000/

One dashboard known to work with the metrics is: https://grafana.com/grafana/dashboards/8729