Gitlab runner in centos 7
21 Feb 2019Install into CentOS 7 1
Prepare
yum update -y
yum install wget git openssl ca-certificates -y
Install
Standalone binaries 2
wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
# or
wget -O /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386
chmod +x /usr/local/bin/gitlab-runner
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
Package
Ubuntu
CentOS
wget https://s3.amazonaws.com/gitlab-runner-downloads/master/rpm/gitlab-runner_amd64.rpm
# or
wget https://s3.amazonaws.com/gitlab-runner-downloads/master/rpm/gitlab-runner_i686.rpm
rpm -i gitlab-runner_amd64.rpm
# or
rpm -i gitlab-runner_i686.rpm
docker run -it --rm -v /var/run/docker.sock:/var/run/docker.sock centos /bin/bash
Gitlab runner example in centos
972 curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
973 sudo chmod +x /usr/local/bin/gitlab-runner
974 useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
975 gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
976 gitlab-runner start
977 gitlab-runner register
runner with docker 3
sudo gitlab-runner register \
--url "https://gitlab.example.com/" \
--registration-token "PROJECT_REGISTRATION_TOKEN" \
--description "docker-ruby-2.1" \
--executor "docker" \
--docker-image ruby:2.1 \
--docker-services postgres:latest \
--docker-services mysql:latest
Register Gitlab runner 4
gitlab-runner register
Gitlab runner link to docker in docker
Run gitlab runner docker, and also can building, and run docker image in runner. 5
docker run -it --name gitlab-runner --restart always \
-v /Users/Shared/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
docker run -it --rm -v /Users/Shared/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner
install
Docker runner may also need register 6
docker run -it --rm -v /Users/Shared/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
# or
docker run -it --rm -v /Users/Shared/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner
config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "test"
url = "https://gitlab.com.au/"
token = "token-string"
executor = "docker"
[runners.docker]
tls_verify = false
image = "php"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]