コンテンツへスキップ
LatchkeyLatchkey home

CI/CD pipelineとは?

CI/CD pipelineとは、コードの変更がcommitから本番まで通過する、各ステップにゲートを備えた自動化されたステージの連続です。

pipelineはソフトウェアデリバリーの組立ラインです。各ステージが1つの仕事をこなし、次へ引き渡し、何かが失敗すればラインを止めます。デリバリー処理をpipelineとして可視化することで、予測可能で改善しやすいものになります。

pipelineとは何か

CI/CD pipelineは、build、テスト、deployなど、変更が順番に通過しなければならない定義された一連の自動ステージです。各ステージは成功して作業を先へ渡すか、失敗して進行を止めるかのどちらかです。pipelineは通常、pushやpull requestのようなコードイベントによって起動されます。

一般的なステージ

  • Source: commitまたはpull requestが実行を起動します。
  • Build: コードをコンパイルし、依存関係をインストールします。
  • Test: ユニット、統合、その他の自動テストを実行します。
  • Package: バージョン管理されたartifactを生成します。
  • Deploy: artifactをstagingへ、次に本番へ昇格させます。

ステージのつながり方

ステージは順番に実行されますが、ステージ内の独立した作業は並列で実行できます。たとえば複数のOSで同時にテストするなどです。いずれかのステージでの失敗は残りを短絡させるため、テストに通らなかったbuildをdeployすることは決してありません。早い段階で生成されたartifactは、再buildされるのではなく後段で再利用されます。

pipelineの例

A four-stage pipeline outline
stages:
  - build      # compile + install deps
  - test       # unit + integration tests
  - package    # produce artifact
  - deploy     # staging -> production

なぜpipelineが重要か

pipelineは、曖昧で手動のrelease処理を、明示的で再現可能なものに変えます。誰もが変更がどこにあり、何が通り、何が失敗したかを見ることができます。ステップがコードで定義されているため、処理は他のコードと同様にバージョン管理され、レビュー可能です。より速いrunnerはpipeline全体を短縮し、これがチームがrunnerの速度に投資する理由です。

Applying this to your pipeline

  • Measure before changing. Most CI optimisation targets the wrong step because the slow one is assumed rather than timed.
  • Cache what is expensive to produce and cheap to validate, and key the cache to the exact tool version.
  • Fail fast: run the cheapest checks that can reject a change first, so an expensive job never starts on code that cannot pass.
  • Prefer determinism over speed when they conflict. A fast pipeline nobody trusts gets re-run, which is slower than a slow one that is believed.

重要なポイント

  • pipelineは、commitからdeployまでの順序付けられた自動ステージの集合です。
  • いずれかのステージでの失敗は残りを止め、本番を保護します。
  • pipelineをコードで定義することで、処理はバージョン管理され、レビュー可能になります。

よくある質問

What is What is a CI/CD Pipeline??
A pipeline is the assembly line of software delivery. Each stage does one job, hands off to the next, and stops the line if something fails. Visualizing your delivery process as a pipeline makes it predictable and easy to improve.
What a pipeline is?
A CI/CD pipeline is a defined series of automated stages, such as build, test, and deploy, that a change must pass through in order. Each stage either succeeds and passes the work forward, or fails and halts progress. The pipeline is usually triggered by a code event like a push or pull request.
How the stages connect?
Stages run in sequence, but independent work within a stage can run in parallel, for example testing on several operating systems at once. A failure in any stage short-circuits the rest, so you never deploy a build that did not pass its tests. Artifacts produced early are reused downstream rather than rebuilt.
Why pipelines matter?
A pipeline turns a fuzzy, manual release process into something explicit and repeatable. Everyone can see where a change is, what passed, and what failed. Because the steps are defined in code, the process is versioned and reviewable like any other code. Faster runners shorten the whole pipeline, which is why teams invest in runner speed.

関連ガイド