-
Notifications
You must be signed in to change notification settings - Fork 613
GitHub Runner Setup
PoAn Yang edited this page Jun 3, 2024
·
1 revision
- Follow Authenticating to the GitHub API to setup a GitHub App.
We already have an app - Longhorn GitHub Runners.
- Deploy gha-runner-scale-set-controller.
NAMESPACE="github-runner"
helm install arc \
--namespace "${NAMESPACE}" \
--create-namespace \
--set replicaCount=3 \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller
- Create a secret for authentication.
We can get app information from Longhorn GitHub Runners.
GITHUB_CONFIG_SECRET="github-runners-config"
GITHUB_APP_ID="<github app id>"
GITHUB_APP_INSTALLATION_ID="<github installation id>"
GITHUB_APP_PRIVATE_KEY=$(cat <pem file path>)
kubectl create secret generic ${GITHUB_CONFIG_SECRET} \
--namespace=${NAMESPACE} \
--from-literal=github_app_id=${GITHUB_APP_ID} \
--from-literal=github_app_installation_id=${GITHUB_APP_INSTALLATION_ID} \
--from-literal=github_app_private_key=${GITHUB_APP_PRIVATE_KEY}
- Setup AMD64 runners.
AMD64_INSTALLATION_NAME="longhorn-infra-amd64-runners"
GITHUB_CONFIG_URL="https://github.com/longhorn"
helm install "${AMD64_INSTALLATION_NAME}" \
--namespace "${NAMESPACE}" \
--create-namespace \
--set githubConfigUrl="${GITHUB_CONFIG_URL}" \
--set githubConfigSecret="${GITHUB_CONFIG_SECRET}" \
--set maxRunners=5 \
--set minRunners=1 \
--set runnerGroup="longhorn-infra" \
--set template.spec.nodeSelector."kubernetes\\.io/arch"=amd64 \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
- Run
kubectl edit AutoscalingRunnerSet -n github-runner longhorn-infra-amd64-runners
to change AMD64 runners with following.spec.template
.
spec:
# other fields ...
template:
spec:
containers:
- command:
- /home/runner/run.sh
env:
- name: DOCKER_HOST
value: unix:///var/run/docker.sock
- name: RUNNER_WAIT_FOR_DOCKER_IN_SECONDS
value: "120"
image: ghcr.io/actions/actions-runner:latest
name: runner
securityContext:
privileged: true
volumeMounts:
- mountPath: /home/runner/_work
name: work
- mountPath: /var/run/docker.sock
name: socket
nodeSelector:
kubernetes.io/arch: amd64
restartPolicy: Never
serviceAccountName: longhorn-infra-amd64-runners-gha-rs-no-permission
volumes:
- emptyDir: {}
name: work
- hostPath:
path: /var/run/docker.sock
type: ""
name: socket
- Setup ARM64 runners.
ARM64_INSTALLATION_NAME="longhorn-infra-arm64-runners"
helm install "${ARM64_INSTALLATION_NAME}" \
--namespace "${NAMESPACE}" \
--create-namespace \
--set githubConfigUrl="${GITHUB_CONFIG_URL}" \
--set githubConfigSecret="${GITHUB_CONFIG_SECRET}" \
--set maxRunners=5 \
--set minRunners=1 \
--set runnerGroup="longhorn-infra" \
--set template.spec.nodeSelector."kubernetes\\.io/arch"=arm64 \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
- Run
kubectl edit AutoscalingRunnerSet -n github-runner longhorn-infra-arm64-runners
to change ARM64 runners with following.spec.template
.
spec:
# other fields ...
template:
spec:
containers:
- command:
- /home/runner/run.sh
env:
- name: DOCKER_HOST
value: unix:///var/run/docker.sock
- name: RUNNER_WAIT_FOR_DOCKER_IN_SECONDS
value: "120"
image: ghcr.io/actions/actions-runner:latest
name: runner
securityContext:
privileged: true
volumeMounts:
- mountPath: /home/runner/_work
name: work
- mountPath: /var/run/docker.sock
name: socket
nodeSelector:
kubernetes.io/arch: arm64
restartPolicy: Never
serviceAccountName: longhorn-infra-arm64-runners-gha-rs-no-permission
volumes:
- emptyDir: {}
name: work
- hostPath:
path: /var/run/docker.sock
type: ""
name: socket