The instructions to install GitLab CI runner are adapted to Ubuntu 14.04 to connect to GitLab CI and run jobs when a commit is pushed to a branch.
A runner token must be obtained from GitLab CI, at the http://cong.dachary.org:8080/projects/1/runners URL for instance.
The gitlab-ci-multi-runner/ is installed as follows:
$ curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash $ sudo apt-get install gitlab-ci-multi-runner $ $ sudo gitlab-ci-multi-runner register Please enter the gitlab-ci coordinator URL (e.g. http://gitlab-ci.org:3000/): http://cong.dachary.org:8080/ Please enter the gitlab-ci token for this runner: 441877520384923424 Please enter the gitlab-ci description for this runner: [cong]: runner1 INFO[0156] 4418775e Registering runner... succeeded Please enter the executor: shell, parallels, docker, docker-ssh, ssh: [shell]: docker Please enter the Docker image (eg. ruby:2.1): golang If you want to enable mysql please enter version (X.Y) or enter latest? If you want to enable postgres please enter version (X.Y) or enter latest? If you want to enable redis please enter version (X.Y) or enter latest? If you want to enable mongo please enter version (X.Y) or enter latest? INFO[0281] Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
It is configured to run each job in a golang docker container. The project git repository is expected to have a .gitlab-ci.yml file at the root. For instance if .gitlab-ci.yml was:
job1: script: "type go"
the GitLab runner would succeed with:
Hey, I was successful getting this runner running thanks to your post 🙂
But I am struggling with an issue regarding my GOPATH.
My .gitlab-ci.yml looks like:
before_script:
- go get github.com/tools/godep
stages:
- build
- test
dependencies:
stage: build
script:
- GOPATH=`godep path`:$GOPATH
- go get --insecure
- godep restore
test:
stage: test
script: make test
But when running the test, the result looks like:
gitlab-ci-multi-runner 0.5.5-1-g69bc934 (69bc934)
Using Docker executor with image golang:latest ...
Running on runner-84683b96-project-1-concurrent-0 via gitlab...
Cloning repository...
Cloning into '/builds/mygroup/go-testrepo'...
Checking out aed9bf9f as master...
$ go get github.com/tools/godep
$ GOPATH=`godep path`:$GOPATH
$ go get --insecure
go install: no install location for directory /builds/mygroup/go-testrepo outside GOPATH
For more details see: go help gopath
ERROR: Build failed with: exit code 1
I already tried adding $CI_PROJECT_DIR to my GOPATH and also copying my repo to $GOPATH/src/mygroup/go-testrepo, but nothing worked.
Do you have another suggestion what I could try here? :/