-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_runner.tpl
31 lines (24 loc) · 1.01 KB
/
install_runner.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Install necessary dependencies
# set -x enables a mode of the shell where all executed commands are printed to the terminal
set -x
echo "Hello from EC2 user data script"
yum update -y
yum install -y curl git
# Install GitLab Runner
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
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
# Start the GitLab Runner service
/usr/local/bin/gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
/usr/local/bin/gitlab-runner start
# Register the GitLab Runner
/usr/local/bin/gitlab-runner register --non-interactive \
--url "https://gitlab.com/" \
--registration-token "${gitlab_runner_registration_token}" \
--executor "shell" \
--description "AWS GitLab Runner" \
--tag-list "aws,linux" \
--run-untagged="true" \
--locked="false"
systemctl status -l gitlab-runner.service