From b41868b05bff24e5f6200ba09029512af5740b3f Mon Sep 17 00:00:00 2001 From: James Blair Date: Wed, 21 Jun 2023 05:40:58 +1200 Subject: [PATCH] Document steps for setting up new actions runner. Signed-off-by: James Blair --- Documentation/infra-guide/arm64-infra.md | 58 ++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Documentation/infra-guide/arm64-infra.md b/Documentation/infra-guide/arm64-infra.md index 2e83e1a76ed3..7c3ec4f9d72c 100644 --- a/Documentation/infra-guide/arm64-infra.md +++ b/Documentation/infra-guide/arm64-infra.md @@ -66,3 +66,61 @@ If the etcd project needs new `arm64` infrastructure we can open an issue with t Note: `arm64` compute capacity is not currently available in all regions, this can be checked with [metal-cli](https://github.com/equinix/metal-cli) `metal capacity get | grep arm`. [CNCF Community Infrastructure Lab]: https://github.com/cncf/cluster/issues + +### Setting up a new github actions runner + +Once the new blank machine has been provisioned it needs to be set up as a github actions runner to be able to accept etcd workflow jobs. Follow the steps below to complete this: + +1. **Install pre-requisites** + +With etcd jobs running inside containers we need to ensure the `docker` container engine is present on the machine. + +```bash +# Ensure all packages are up to date +sudo apt update && sudo apt upgrade + +# Install pre-requisites +sudo apt install --yes build-essential git wget curl docker.io + +# Check the docker service is now started and enabled +sudo systemctl status docker.service && sudo docker ps +``` + +2. **Create the runner user** + +For security reasons we do not run the github actions runner as `root`, instead we create a new user `runner`. + +```bash +sudo adduser runner +``` + +3. **Follow runner create instructions** + +Once pre-requisites are done we can setup the new runner. Rather than reinvent the wheel we can follow existing Github maintained [documentation](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-a-repository). + +This will essentially require a maintainer navigating to the following url and following the generated steps . + +Switch to the `runner` user and ensure you are in that users home directory before running the generated setup steps. + +```bash +sudo su runner && cd /home/runner +``` + +4. **Grant actions runner user docker access** + +One final step for the actions runner to be able to run workflow jobs in containers is to grant it permissions to the `docker` group. + +```bash +# Grant permissions +sudo usermod -aG docker runner + +# Switch to the runner user +sudo su runner + +# Restart runner for permissions to take effect +ps aux | grep -ie run-helper | awk '{print $2}' | xargs kill -9 +cd /home/runner/actions-runner && nohup ./run.sh & + +# Test runner can docker ps +docker ps +```