Skip to content

Jenkins

一句话解释

Jenkins 是打开-源 automation 服务器那个 helps 构建, 测试, and 部署 code 通过 configurable 流水线.

用大白话说

Jenkins is one of the oldest and most widely used CI/CD tools. It is a self-contained automation server that runs on Java and provides a web interface for defining and running pipelines.

You define pipelines in a Jenkinsfile — either as declarative or scripted pipeline syntax. A pipeline consists of stages like "构建", "测试", "部署". Jenkins executes each stage and shows the results in a visual dashboard.

Jenkins has a huge ecosystem of plugins (over 1,500) that integrate with almost any tool — Git, Docker, Kubernetes, AWS, Slack, etc. This flexibility makes it powerful but also means it requires more maintenance than newer CI/CD tools.

示例

groovy
pipeline {
    agent any
    stages {
        stage('Build') {
            steps { sh 'npm run build' }
        }
        stage('Test') {
            steps { sh 'npm test' }
        }
        stage('Deploy') {
            steps { sh 'kubectl apply -f k8s/' }
        }
    }
}

这个 Jenkinsfile 定义流水线使用 three stages: 构建, 测试, and 部署到 Kubernetes.

工作原理

  1. You define a pipeline in a Jenkinsfile (in your repo or in Jenkins).
  2. Jenkins detects a code change (via webhook or polling).
  3. It runs the pipeline stages on an agent (build, test, deploy).
  4. Results are shown in the Jenkins dashboard with logs and status.

常见混淆

  • 容易混淆的对象: GitHub 操作

    关键区别: Jenkins 是 self-hosted 服务器那个需要 maintenance; GitHub 操作是 managed service 构建到 GitHub 使用否 服务器到 maintain.

相关术语

解读错误信息

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

查看错误

← 返回术语表