当前位置:网站首页>Jenkins pipeline syntax

Jenkins pipeline syntax

2022-06-12 09:02:00 Commander in chief (commander in chief)

Official website

https://www.jenkins.io/doc/book/pipeline/

according to Jenkins Official website Pipeline Explanation given , There are two kinds of pipeline syntax ,

  • One is declarative pipeline (Declarative Pipeline)
  • The other is scripted pipeline (Scripted Pipeline)
What to pay attention to

The declarative syntax is different from the scripted syntax , Please note that

Declarative pipeline

The basic framework of declarative pipeline script is as follows , What needs to be noticed is :

  • The outermost pipeline{} Represents the entire pipeline , Include all the concrete implementations
  • agent Fields are essential
  • stages{} There can only be one structure , But a stages{} A structure can contain multiple stage{}
  • Every stage{} Must have a specific name , Every stage{} There can only be one steps{}
pipeline {
    
    agent any //agent  Specify the running node of this pipeline task later , It is generally a fixed node ip Address 
              //agent any Indicates that the pipeline task is specified to run on any node 
    stages {
    
        stage('Build') {
     // Define build phase 
            steps {
    
                //  Perform specific build tasks ...
            }
        }
        stage('Test') {
     // Define the unit test phase 
            steps {
    
                //  Perform specific test contents ...
            }
        }
        stage('Deploy') {
     // Define deployment phase 
            steps {
    
                //  Perform specific deployment operations ...
            }
        }
    }
}
原网站

版权声明
本文为[Commander in chief (commander in chief)]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206120857336871.html