Skip to content

Specifying The Custom Runner Server Setup Script

vzakaznikov edited this page Feb 28, 2024 · 4 revisions

You can specify a custom runner server setup script using the --scripts option which can be used to specify a path to the folder that contains all your custom runner server scripts.

For example, you can create a local folder called scripts and add your custom setup.sh that will overwrite the default setup.sh script that is defined in testflows/github/hetzner/runners/scripts/setup.sh.

mkdir scripts

Then, inside the scripts folder you can place your custom setup.sh. For example,

scripts/setup.sh:
#!/bin/bash
set -x
echo "Create and configure ubuntu user"
adduser ubuntu --disabled-password --gecos ""
echo "%wheel   ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
addgroup wheel
addgroup docker
usermod -aG wheel ubuntu
usermod -aG sudo ubuntu
usermod -aG docker ubuntu
# custom setup
apt-get -y update
apt-get -y install ca-certificates curl gnupg lsb-release python3-pip git unzip

You can apply your custom scripts using the --scripts option as follows:

github-hetzner-runners --scripts ./scripts

Job Specific Custom Setup Script

The default server setup script is setup.sh. However, you can use the setup-{name} label to select any custom script inside the scripts directory that you can specify using the --scripts option. Where the {name} shall match the {name}.sh file inside the scripts folder.

✋ Note: Note the .sh extension is assumed for the script {name}.

For example,

scripts/
scripts/custom.sh
job-name:
   runs-on: [self-hosted, setup-custom]
Clone this wiki locally