[Jenkins] Define a pipeline

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[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.

以上是关于[Jenkins] Define a pipeline的主要内容,如果未能解决你的问题,请参考以下文章

史上最全 Jenkins Pipeline流水线详解

Jenkins高级用法 - Jenkinsfile 介绍及实战经验

实现并发的管道

kubernetes 基于jenkins spinnaker的ci/cd实践一增加制品镜像扫描

聊聊storagetapper的pipe

pipe和queue.py