[Jenkins] Define a pipeline

node{
    stage 'checkout'
    git '[github_url]'
    
    def project_path="[project_path]"
    
    // everythin in dir block will based on project bath 
    dir(proejct_path) {
        
        stage 'compiling, test, packing'
        sh 'mvn clean package'
        
        stage 'archival'
        step([
            $class: 'ArtifcatArchiver',
            artifacts: "target/*.jar",
            excludes: null
            ])
    }
}

 

Add 'stage' which we can know what is the progress in a high level way:

 

'sh' is for any shell commands.

Pipeline is written in Rudy, so can use rudy syntax to def a variable.

posted @ 2017-04-24 04:16  Zhentiw  阅读(257)  评论(0)    收藏  举报