首页 > 解决方案 > 当新文件夹完全复制到目录时,我需要触发 Jenkins 作业

问题描述

当构建(文件夹)完全复制到目录时,我需要触发 jenkins 作业。这里构建文件夹副本需要一些时间。我的要求是等到文件夹复制完成并触发詹金斯作业。

标签: jenkins

解决方案


It can be done in a various way, Take a look at my example

pipeline {
    agent any;
    stages {
        stage('copy') {
            steps {
              sh """
                cp -r /path/from/copy /path/to/copy
              """  
            }
            
        }
        stage('other') {
            steps {
                rcho "I will run after copy stage is done"
            }
        }
    }
    /*
    // you can take advantage of post DSL for your scenario as well
    post {
        success {
            echo "I will run when job is success"
        }
        failure {
            echo "I will run when the job is fail"
        }
    }
    */
}

推荐阅读