github actionsをself-hostedで実行するためにActions Runner Controllerを導入する。導入は公式ドキュメントのクイックスタート通りに進めれば問題なくインストールできるが、せっかくなのでインストール設定をhelmfileでバージョン管理する。
personal access tokenの作成
公式ドキュメントに従ってgithubのトークンを作成しておく。必要なスコープは以下を参照されたい。
ARC ランナーに必要な personal access token スコープの一覧を次に示します。
- リポジトリ ランナー:
repo- Organization ランナー:
admin:org
helmfileの記述
helmfileに今回利用するchartを記述する。
releases:- name: arc namespace: arc-systems createNamespace: true chart: oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller version: 0.9.3- name: arc-runner-set namespace: arc-runners createNamespace: true chart: oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set version: 0.9.3 set: - name: githubConfigUrl value: "<your repository url>" - name: githubConfigSecret.github_token value: "{{ requiredEnv "GITHUB_PAT" }}" # WOURAROUND: 次のエラーを回避 Error: execution error at (gha-runner-scale-set/templates/manager_role_binding.yaml:17:11): No gha-rs-controller deployment found using label (app.kubernetes.io/part-of=gha-rs-controller). Consider setting controllerServiceAccount.name in values.yaml to be explicit if you think the discovery is wrong. - name: controllerServiceAccount.name value: arc-gha-rs-controller - name: controllerServiceAccount.namespace value: arc-systems- 適用時にcontrollerのサービスアカウントを陽に設定しないとdeploymentが見つからないというエラーが発生するので設定する。
- github tokenはsecret情報なのでファイルにそのまま記述せず、環境変数から設定する。helmfileはhelm-secretsに対応しているのでこの利用も検討できる。
適用
$ GITHUB_PAT=foo helmfile apply適用後はgithubの画面からrunnerが認識されていることがわかる。

お試しでworkflowを組んで確認してみる。
name: Actions Runner Controller Demoon: workflow_dispatch:
jobs: Explore-GitHub-Actions: # You need to use the INSTALLATION_NAME from the previous step runs-on: arc-runner-set steps: - run: echo "🎉 This job uses runner scale set runners!"無事にworkしていることが確認できる。