Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@samsulmaarif
Last active March 5, 2024 10:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save samsulmaarif/d11595c65dc69f8af505a11e464461b1 to your computer and use it in GitHub Desktop.
Save samsulmaarif/d11595c65dc69f8af505a11e464461b1 to your computer and use it in GitHub Desktop.
Script to install GitLab Runner on openSUSE Leap 15.2
#!/usr/bin/env bash
set -x
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
zypper ref
zypper install -y docker
systemctl enable docker
systemctl start docker
if [ -e /usr/local/bin/gitlab-runner ]; then
echo "Gitlab Runner already installed"
else
curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64
chmod +x /usr/local/bin/gitlab-runner
fi
if [ -e /usr/local/bin/docker-machine ]; then
echo "Docker Machine already installed:"
else
curl -L https://gitlab-docker-machine-downloads.s3.amazonaws.com/master/docker-machine > /usr/local/bin/docker-machine
chmod +x /usr/local/bin/docker-machine
fi
if [ "$1" != "" ]; then
runner_user=$1
else
runner_user=gitlab-runner
fi
if id $runner_user &>/dev/null; then
echo "User $runner_user already exist"
else
useradd --comment 'GitLab Runner' --create-home $runner_user --shell /bin/bash
usermod -aG docker $runner_user
usermod -aG google-sudoers $runner_user
fi
/usr/local/bin/gitlab-runner install --user=$runner_user --working-directory=/home/$runner_user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment