setup gitlab-docker on MacOS properly & test .gitlab-ci.yml locally

Installation

brew install gitlab-runner
brew service start gitlab-runner
sudo reboot

Make sure your docker connection is working

> curl https://registry-1.docker.io/v2/ && echo Works
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
Works

If Works does not popup on your terminal, add one of the working ip from host to /etc/hosts

> host registry-1.docker.io
registry-1.docker.io has address 54.210.105.17
registry-1.docker.io has address 52.87.94.70
registry-1.docker.io has address 3.221.133.86
registry-1.docker.io has address 100.24.246.89
registry-1.docker.io has address 52.70.175.131
registry-1.docker.io has address 3.210.179.11
registry-1.docker.io has address 52.55.198.220
registry-1.docker.io has address 54.88.231.116


> tail /etc/hosts
52.70.175.131 registry-1.docker.io # I added this

Test .gitlab-ci.yml locally

gitlab-runner exec docker --docker-helper-image=gitlab/gitlab-runner:alpine {JOB_NAME_HERE}
gitlab-runner exec docker --docker-helper-image=gitlab/gitlab-runner:alpine install_dependency