This repository has been archived by the owner on Sep 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.sh
57 lines (45 loc) · 1.73 KB
/
install.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -ex
# Fresh
apt-get update
# Upgrade base
apt-get -y upgrade
# Install setup dependencies
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
lsb-release \
software-properties-common \
;
# Install docker repo
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Add Git PPA
add-apt-repository -y ppa:git-core/ppa
apt-get update
# Create a runner user
useradd -ms /bin/bash runner
# Install the runner and its dependencies
mkdir -p /opt/actions-runner && cd /opt/actions-runner
curl -sLO https://github.com/actions/runner/releases/download/v${ACTIONS_RUNNER_VERSION}/actions-runner-linux-x64-${ACTIONS_RUNNER_VERSION}.tar.gz
tar xzf ./actions-runner-linux-x64-${ACTIONS_RUNNER_VERSION}.tar.gz
rm ./actions-runner-linux-x64-${ACTIONS_RUNNER_VERSION}.tar.gz
/opt/actions-runner/bin/installdependencies.sh
# Begrudgingly allow the runner to modify itself as it writes logs to ./_diag and credentials to ./.*
chown -R runner /opt/actions-runner
# Install utilities
# TODO grab this from https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners somehow?
apt-get install -y \
docker-ce \
git \
inetutils-ping \
sudo \
;
# Hook up the runner user with passwordless sudo
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#administrative-privileges-of-github-hosted-runners
echo "runner ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/runner
chmod 0440 /etc/sudoers.d/runner
# Cleanup
rm -rf /var/lib/apt/lists/*