[官方文档] https://jenkins.io/doc/
jenkins pipeline 是Jenkins中实现和集成连续交付的一套插件。持续交付是将软件的版本控制直接传给客户和用户的自动化表达。
pipeline features:
-
Code(编码): Pipelines are implemented in code and typically checked into source control, giving teams the ability to edit, review, and iterate upon their delivery pipeline.
-
Durable(耐用的): Pipelines can survive both planned and unplanned restarts of the Jenkins master.
-
Pausable(可暂停的): Pipelines can optionally stop and wait for human input or approval before continuing the Pipeline run.
-
Versatile(通用的): Pipelines support complex real-world CD requirements, including the ability to fork/join, loop, and perform work in parallel.
-
Extensible(可扩展的): The Pipeline plugin supports custom extensions to its DSL [1] and multiple options for integration with other plugins.
pipeline concept:
pipeline 管道的代码定义了整个构建过程,通常包括构建应用程序、测试应用程序和交付应用程序的阶段。
node 节点是Jenkins环境的一部分,能够执行管道的机器。
stage 块定义了通过整个管道执行的任务的概念上不同的子集(例如,“Build”、“Test”和“Deploy”stage),许多插件都使用它来可视化或显示Jenkins管道的状态/进度。
step 一个单一的任务。基本上,一个步骤告诉Jenkins在特定时间点(或过程中的“步骤”)要做什么。例如,要执行shell命令,请使用sh步骤:sh 'make'。当插件扩展管道DSL时,通常意味着插件已经实现了一个新步骤。
pipeline syntax:
pipeline is Declarative Pipeline-specific syntax that defines a "block" containing all content and instructions for executing the entire Pipeline. |
agent is Declarative Pipeline-specific syntax that instructs Jenkins to allocate an executor (on a node) and workspace for the entire Pipeline. |
stage is a syntax block that describes a stage of this Pipeline. Read more about stage blocks in Declarative Pipeline syntax on the Pipeline syntax page. As mentioned above, stage blocks are optional in Scripted Pipeline syntax. |
steps is Declarative Pipeline-specific syntax that describes the steps to be run in this stage . |
sh is a Pipeline step (provided by the Pipeline: Nodes and Processes plugin) that executes the given shell command. |
junit is another a Pipeline step (provided by the JUnit plugin) for aggregating test reports. |
node is Scripted Pipeline-specific syntax that instructs Jenkins to execute this Pipeline (and any stages contained within it), on any available agent/node. This is effectively equivalent to agent in Declarative Pipeline-specific syntax. |