Files
terraform/modules/apps/bookshelf/lib/scripts/install-runner.sh

59 lines
1.5 KiB
Bash

#!/bin/bash
source /opt/bookshelf/env.sh
if ! id -u $ACT_RUNNER_USER >/dev/null 2>&1; then
adduser \
--system \
--shell /bin/bash \
--gecos 'Action runner user' \
--ingroup docker\
--disabled-password \
--home /home/$ACT_RUNNER_USER \
$ACT_RUNNER_USER
fi
wget -O $ACT_RUNNER_LOCATION/act_runner https://dl.gitea.com/act_runner/$ACT_RUNNER_VERSION/act_runner-$ACT_RUNNER_VERSION-linux-amd64
chmod +x $ACT_RUNNER_LOCATION/act_runner
cat <<EOF > /home/$ACT_RUNNER_USER/config.yaml
log:
level: info
runner:
file: .runner
capacity: 1
timeout: 3h
shutdown_timeout: 0s
insecure: false
fetch_timeout: 5s
env_file: $ENV_FILE_LOCATION
fetch_interval: 2s
github_mirror: ''
labels:
- "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
- "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
- "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"
cache:
enabled: true
dir: ""
host: ""
port: 0
external_server: ""
container:
network: ""
privileged: false
options:
workdir_parent:
valid_volumes: []
docker_host: ""
force_pull: true
force_rebuild: false
require_docker: false
docker_timeout: 0s
host:
workdir_parent:
EOF
cd /home/act_runner
sudo -u $ACT_RUNNER_USER act_runner register --no-interactive --instance $GITEA_INSTANCE_URL --token $GITEA_RUNNER_REGISTRATION_TOKEN --name $USERNAME --labels $USERNAME $REPOSITORY
chown -R $ACT_RUNNER_USER:docker /home/$ACT_RUNNER_USER