For shell executor we need git with fetch-pack support (git 2.x ?)
$ git --version
Remove git 1.8 and install git 2.2:
# yum install -y https://repo.ius.io/ius-release-el7.rpm # rpm -e --nodeps git # rpm -e --nodeps perl-Git # yum install -y git222
Make sure ip forwarding is enabled:
# cat /proc/sys/net/ipv4/ip_forward # vim /etc/sysctl.conf ... net.ipv4.ip_forward = 1 # sysctl -p /etc/sysctl.conf # cat /proc/sys/net/ipv4/ip_forward
Get <TOKEN> from gitlab -> project -> settings -> CI/CD -> Runners -> Set up a specific runner manually
# curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash # export GITLAB_RUNNER_DISABLE_SKEL=true; yum install gitlab-runner
Regiter non-interactively:
# gitlab-runner register --non-interactive --url https://gitlab.com/ --registration-token <TOKEN> --executor shell --docker-image "7.4-fpm-alpine" --docker-privileged=true --tag-list <tag_name,other_tag_name>
( or register interactively):
# gitlab-runner register Enter the GitLab instance URL (for example, https://gitlab.com/): https://gitlab.com/ Enter the registration token: <TOKEN> Enter an executor: custom, parallels, ssh, docker-ssh+machine, kubernetes, docker, docker-ssh, shell, virtualbox, docker+machine: shell Enter the default Docker image (for example, ruby:2.6): 7.4-fpm-alpine
Add gitlab-runner user to docker group:
# usermod -aG docker gitlab-runner
Run:
# systemctl start gitlab-runner; systemctl status gitlab-runner
http://codingtools.net/cheatsheet/centos7-docker
# docker swarm init --advertise-addr=eth0
Add gitlab personal access token:
Login to gitlab registry:
$ docker login registry.gitlab.com Username: <gitlab_email> Password: <token>
Tag the local container with gitlab full path & tag:
$ docker tag <ID_of_the_image> registry.gitlab.com/project-path/project-name/image-name:version-tag
Push it to gitlab registry:
$ docker push registry.gitlab.com/project-path/project-name/image-name:version-tag