jenkins學習之Jenkins流水線中load其他groovy文件

           steps {
                script {
                    def util = load("${env.WORKSPACE}/scripts/build_util.groovy")
                    util.runStep1()
                }
            }
            steps {
                script {
                    def util = load("${env.WORKSPACE}/scripts/build_util.groovy")
                    util.runStep2()
                }
            }
            steps {
                script {
                    def util = load("${env.WORKSPACE}/scripts/build_util.groovy")
                    util.runStep3()
                }
            }
stage('Environment') {
     agent  { node { label 'master' } }
        steps {
          script {
                def util = load("${env.WORKSPACE}/scripts/build_util.groovy")
               }
            }
         }
post {
        // Things that we want done regardless of pipeline's outcome
        //
        always {

            // Push the overall statistics from all the stages to InfluxDB
            //
            node (LINUX_BUILD_NODE){
                script{
                    //Mail sending function call
                    //
                    util.runStep1()
                    util.runStep2()
                    util.runStep3()                        
                }
            }
        }
    }
def util;

pipeline {
   agent any
   stages {
      stage('one') {
        steps {
            script {
                util = load("${env.WORKSPACE}/scripts/build_util.groovy")
                util.runStep1()
            }
        }
      }
      post {
        util.xxxx
      }

      stage('two') {
        steps {
            script {
                util = load("${env.WORKSPACE}/scripts/build_util.groovy")
                util.runStep2()
            }
        }
      }
      post {
        util.xxxx
      }

   }

   post {
        util.xxxx
   }
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章