当新文件夹完全复制到目录时,我需要触发 Jenkins 作业

时间:2021-02-25 16:35:08

标签: jenkins

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

1 个答案:

答案 0 :(得分:0)

可以通过多种方式完成,看看我的例子

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"
        }
    }
    */
}
相关问题