エフェメラルCIとは? 新しいrunnerが重要な理由
エフェメラルCIは、すべてのjobに、jobが終わると捨てられるクリーンな使い捨てマシンを与える - どの実行も次を汚染できないように。
エフェメラルrunnerは1つのjobのために作られ、後で破棄され、状態を残さない。実行をまたいでファイル、cache、副作用を蓄積する長寿命runnerとは正反対だ。
「エフェメラル」の意味
新しい環境が単一のjobのためにプロビジョニングされ、そのjobを実行し、破棄される。それが書き込んだもの - 一時ファイル、インストールされたツール、漏れたプロセス - は何も次のjobに影響を与えるほど残らない。すべての実行が同じ既知のベースラインから始まる。
それが重要な理由
- 状態漏れなし: あるjobが別のjobの環境を汚染できない。
- 再現性: greenなbuildは、残った状態のためではなく、クリーンな状態から合格することを意味する。
- セキュリティ: secretやcheckoutデータが共有マシンに残らない。
- デバッグが容易: 失敗が「runnerをクリアしたら動く」ではなくなる。
トレードオフ
クリーンなマシンには何もcacheされていないため、エフェメラルrunnerはjobごとにcold startと依存関係インストールの税を払う。標準的な緩和策は、汚れた状態を共有せずに高価な部分を復元する外部cache(依存関係、Dockerレイヤー)だ。
エフェメラル vs 永続
永続runnerは状態が引き継がれるため速いが、その同じ状態が「runner #3でだけ通る」flakinessを引き起こす。ほとんどのチームは正しさのためにエフェメラルを選び、速度を取り戻すためにcacheを加える。
重要なポイント
- エフェメラル = jobごとに新しい使い捨てマシン、後で破棄される。
- 実行間の状態漏れを排除し、再現性とセキュリティを向上させる。
- コストはcold startと繰り返される依存関係のインストールだ。
- cacheは、汚れた共有状態を再導入せずに速度を回復する。
よくある質問
What is What is ephemeral CI? why fresh runners matter?
An ephemeral runner is created for one job and destroyed afterward, leaving no state behind. It is the opposite of a long-lived runner that accumulates files, caches, and side effects across runs.
What "ephemeral" means?
A fresh environment is provisioned for a single job, runs that job, and is torn down. Nothing it wrote - temp files, installed tools, leaked processes - survives to affect the next job. Every run starts from the same known baseline.
The trade-off?
A clean machine has nothing cached, so ephemeral runners pay a cold-start and a dependency-install tax on every job. The standard mitigation is an external cache (dependencies, Docker layers) that restores the expensive bits without sharing dirty state.
Ephemeral vs persistent?
Persistent runners are faster because state carries over, but that same state causes "passes only on runner #3" flakiness. Most teams choose ephemeral for correctness and add caching to claw back the speed.
関連ガイド
Cold Start vs Warm Start in CI: Where the Wait Comes FromA cold start provisions a fresh runner before a job begins; a warm start reuses a ready one.
Dependency Caching Strategies for Faster CIRe-downloading dependencies every run is wasted time. Learn what to cache, how to key it on a lockfile, and
What Is a CI Runner Image (or AMI)?A runner image is the prebuilt disk template a CI runner boots from, with the OS and tools already installed.