Alibaba Cloud - Github Action Runner
Objective: To host Github Action Runner in Alicloud environment
There are 2 types of runner in Github, repository level and organization level. In order for this to work ensure that your alibaba kubernetes cluster is running Alicloud Cloud OS 3
Prerequisite:
1. Install kubectl in local machine Download Kubectl for Windows
2. Install helm in local machine Helm | Installing Helm
3. Setup kubectl pointing to ACK. Go to Alicloud ACK cluster > Connection Info Container Service Console
4. Go to Github, generate github PAT under
Account > Settings > Developer Settings > Personal accesss tokens > Tokens (classic)
with repo scope for repo level runner or repo+admin:org scope for org level runner
Steps 1: Prepare a script
Create a script call arc-runner-set-values.yaml (dind mode is required for docker build to execute). This will spawn max 3 runners
## maxRunners is the max number of runners the autoscaling runner set will scale up to.
maxRunners: 3
## minRunners is the min number of runners the autoscaling runner set will scale down to.
minRunners: 1
## Container mode is an object that provides out-of-box configuration
## for dind and kubernetes mode. Template will be modified as documented under the
## template object.
##
## If any customization is required for dind or kubernetes mode, containerMode should remain
## empty, and configuration should be applied to the template.
containerMode:
type: "dind"
Step 2: Helm install action runner controller (ARC) in ACK
NAMESPACE="github-runner-ctrl"
helm install arc --namespace "${NAMESPACE}" --create-namespace oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller
Note: can use yaml files to override default values
Step 3: Helm install runner scale set in ACK
INSTALLATION_NAME="github-runner"
NAMESPACE="github-runner-pod"
GITHUB_CONFIG_URL="https://github.com/{your_organization}"
GITHUB_PAT="<PAT>"
helm install "${INSTALLATION_NAME}" \
--namespace "${NAMESPACE}" \
--create-namespace \
--set githubConfigUrl="${GITHUB_CONFIG_URL}" \
--set githubConfigSecret.github_token="${GITHUB_PAT}" \
--values arc-runner-set-values.yaml \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
To install runner in org level:
i. Update GITHUB_CONFIG_URL to org URL, for example
ii. Update https://github.com/{your org} GITHUB_PAT to include rights under repo and admin:org (refer to prerequisite)
3. Run helm list -A to check whether arc-systems and arc-runners are installed
4. Run kubectl get pods -n arc-systems to check both controller and listener is running
5. Go to github repo and check self-hosted runner is registered
Subscribe to my newsletter
Read articles from Kev directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by