Skip to content

How to install gitlab-runner (on Centos7)#

These are the steps to install gitlab-runner on a new VM, and with all the required packages to be able to run CORAL and COOL tests. The last step (commented out in the following) needs information accessible on gitlab.

# as root
# install gitlab-runner
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
yum install gitlab-runner -y
usermod -a -G tty gitlab-runner

# install cvmfs
yum install https://ecsft.cern.ch/dist/cvmfs/cvmfs-release/cvmfs-release-latest.noarch.rpm -y
yum install cvmfs cvmfs-config-default -y
echo CVMFS_REPOSITORIES=sft.cern.ch >> /etc/cvmfs/default.local
echo CVMFS_HTTP_PROXY=DIRECT >> /etc/cvmfs/default.local
cvmfs_config setup

# install base packages
yum install http://linuxsoft.cern.ch/wlcg/centos7/x86_64/wlcg-repo-1.0.0-1.el7.noarch.rpm -y
yum install HEP_OSlibs -y

# install jq for COOL's .gitlab-ci.yml
yum install jq -y

# for network glitch (CORALCOOL-3012: https://sft.its.cern.ch/jira/browse/CORALCOOL-3012)
su - gitlab-runner
ssh-keygen -q -b 4096 -N "" -f /home/gitlab-runner/.ssh/id_rsa
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
exit

#copy the dblookup and authentication to the home directory
scp -o StrictHostKeyChecking=no coral-cc7:/home/gitlab-runner/dblookup.xml /home/gitlab-runner/
scp -o StrictHostKeyChecking=no coral-cc7:/home/gitlab-runner/authentication.xml /home/gitlab-runner/

# to get /etc/tnsnames.ora, which is required to run oracle tests, since gitlab-runner doesn't have access to eos...
yum-config-manager --enable cernonly
yum install oracle-instantclient-tnsnames.ora -y

# as root 
# Last step: register the runner:
# take the tokens from https://gitlab.cern.ch/lcgcoral/coral/-/settings/ci_cd#js-runners-settings
# and https://gitlab.cern.ch/lcgcool/cool/-/settings/ci_cd#js-runners-settings
# CORAL_TOKEN=XXX
# COOL_TOKEN=YYY
# gitlab-runner register --non-interactive --tag-list 'centos7' --url 'https://gitlab.cern.ch/' --registration-token $CORAL_TOKEN --executor shell
# gitlab-runner register --non-interactive --tag-list 'centos7' --url 'https://gitlab.cern.ch/' --registration-token $COOL_TOKEN --executor shell

We could improve the creation of the gitlab-runner. We could create a docker image and run the tests on docker/kubernetes. We could also grant access to eos, but we have to :

# install eos for centos7
locmap --enable eosclient; locmap --configure eosclient
# We need a kerberos ticket to access it, which the gitlab-runner does not have...