Skip to content

流水线

一句话解释

流水线是 automated 序列的 steps (构建, 测试, 部署) 那个 code 通过通过从 提交到 production.

用大白话说

pipeline 是the automated flow that your code goes through from the moment a developer commits it to the moment it reaches production。 It is a series of stages connected like a pipe — the output of one stage feeds into the next.

A typical pipeline has stages like: Source (trigger on commit) → Build (compile code) → Test (run automated tests) → Package (create artifact/image) → Deploy (push to environment). If any stage fails, the pipeline stops and the team is alerted.

Pipelines make deployments reliable and repeatable. Instead of a developer manually building and deploying, the pipeline does it the same way every time — no human error, no forgotten steps.

示例

yaml
pipeline:
  - stage: Build
    run: npm run build
  - stage: Test
    run: npm test
  - stage: Package
    run: docker build -t app:latest .
  - stage: Deploy
    run: kubectl apply -f k8s/

conceptual 流水线使用 four stages: 构建, 测试, 包 as Docker 镜像, and 部署到 Kubernetes.

工作原理

  1. A trigger fires the pipeline (commit, PR, schedule, manual).
  2. Each stage runs in order — build, test, package, deploy.
  3. If a stage fails, the pipeline stops and sends an alert.
  4. If all stages pass, the code reaches the target environment.

常见混淆

  • 容易混淆的对象: Workflow

    关键区别: 流水线是 linear 序列的 stages; workflow 能有 branching, parallel paths, and 复杂 dependencies.

相关术语

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表