# エフェメラルCIとは? 新しいrunnerが重要な理由

> エフェメラルCIとは、各jobが後で破棄される新しい使い捨て環境で動くことを意味する。それがなぜバグを防ぎ、何を犠牲にするかを学ぼう。

Source: https://latchkey.dev/ja/learn/ci-cd-concepts/what-is-ephemeral-ci  
Updated: 2026-06-25

エフェメラル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を加える。

## FAQ

### 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
