1. jenkins-Pipeline basic grammar
1) jenkins-Pipeline general introduction
• Pipeline, in short, is set to run with the workflow framework on jenkins, originally run independently connected to a single task or multiple nodes to achieve difficult to accomplish a single task orchestration complex and visualized.
• Pipeline is the core characteristic jenkins2.x, jenkins help achieve the transition from the CI to the CD and devops
• https://jenkins.io/2.0/
2) What is the Pipeline jenkins
• jenkins Pipeline is a set of plug-ins, so you can jenkins realization and implementation of landing continuous delivery pipeline.
• continuous delivery pipeline (CD Pipeline) is a version control software from the stage to the delivery performance to automate the complete process or user clients
• Software every change (to submit the source code management system) must go through a complex process in order to be published
• Pipeline provides a set of scalable tools, can achieve their goals through Pipeline as Code Domain Specific Language Pipeline (DSL) syntax
• Pipeline AS code: jenkinsfile stored in the source code repository project
3) Why Pipeline
• Code: Pipeline realized in the form of code, commonly checked into source control, so that the team can edit, censor its CD and iterative processes
• sustainability: jenkins restart or after an interruption will not affect Pipeline job
• pause: Pipeline can choose to stop and wait for manual input or approval, and then continue to run at Pipeline.
• Versatile: Pipeline CD support complex real-world requirements, including the fork / join sub-process, circulation and the ability to parallel implementation.
Scalable: Pipeline Support for custom plug-ins to expand its DSL and multiple options for integration with other plug-ins
4) pipeline basic grammar
Stage • • stage, a pipeline can be divided into several Stage, Stage on behalf of each of a set of actions, such as columns: "Build", "Test" , "Deploy". • Note, Stage is a logical grouping of generous idea, across multiple node • the Node • node, a node is a node jenkins, or Master, or Agent, is to perform Step specific operating environment. The Step • • step, Step is the most basic operating unit, small enough to create a directory, to build a docker large mirror, provided by all kinds of jenkins Plugin, such as: sh 'make'
5) jenkins Pipeline Starter
• pipeline is implemented by the Groovy script language • without any special training Groovy • Pipeline supports both syntax • Declarative declarative (2.5 introduced the plugin Pipeline) • Scripted Pipeline scripted • how to create a basic Pipeline • jenkins Web UI directly in the web interface enter the script • a jenkinsfile can check in the project by creating a source control repository • best practices • generally recommended load jenkinsfile Pipeline in jenkins directly from source control (SCM) in
6) jenkins write simple scripts pipeline
{Node Stage ( 'pulling Code') { echo 'pull Code " } Stage (' code compilation ') { echo" code compilation " } Stage (' release testing deployment ') { echo' Deployment release test" } }
(1) Construction of a Pipeline Pipeline-demo
(2) Create a Pipeline-demo line
(3) pipeline Scripting
(4) then save build
(5) Construction of effect