GitHub Actions の self-hosted runner とは?
self-hosted runner は GitHub に登録された自分自身のマシンで、GitHub ホストの VM の代わりに Actions のジョブを実行します。
GitHub ホストランナーは便利ですが、ハードウェア、ソフトウェア、ネットワークアクセスに制限があります。self-hosted runner を使うと、自分のインフラを持ち込んで、コントロール、特殊なハードウェア、あるいはプライベートネットワークアクセスを得られます。
それは何か
GitHub Actions のランナーエージェントを実行し、リポジトリ、組織、または enterprise に登録された、物理または仮想のマシンです。ジョブは self-hosted ラベルでそれを対象にします。
Targeting self-hosted
jobs:
build:
runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v4
- run: makeどう動くか
登録トークンを使ってランナーエージェントをインストールし設定します。それは GitHub を一致するジョブについてポーリングし、それらを実行し、報告を返します。あなたが制御するハードウェアと OS 上で行われます。
トレードオフ
- 利点: カスタムハードウェア、GPU、プライベートネットワーク、分単位の料金なし。
- 欠点: マシンの保守、スケール、セキュリティ、パッチ適用を自分で行う。
- セキュリティ: 公開 repo の PR で self-hosted runner を使うのは避けます。
なぜ重要か
self-hosting はコストを削減し能力を解放できますが、運用の負担は現実的です。Latchkey のようなマネージドランナーは、プロビジョニング、スケーリング、自己修復を代行しながら、self-hosted のようなコントロールとコスト削減を提供します。
関連する概念
self-hosted runner はラベルと runner group を使って対象を制御し、Actions Runner Controller でオートスケールできます。
重要なポイント
- self-hosted runner は自分自身の登録済みマシンです。
self-hostedラベルで対象にします。- コントロールを得ますが、保守とセキュリティを負います。
関連ガイド
What Is a GitHub Actions Runner?A runner is the machine that executes a GitHub Actions job. It can be GitHub-hosted, self-hosted, or a manage…
What Is a Runner Label in GitHub Actions?A runner label is a tag on a runner that jobs match in runs-on, letting you route work to runners with the ri…
What Is a Runner Group in GitHub Actions?A runner group is an organization-level collection of self-hosted runners with access policies controlling wh…
What Is Actions Runner Controller (ARC)?Actions Runner Controller (ARC) is a Kubernetes operator that autoscales self-hosted GitHub Actions runners a…