2017-05-03 71 views
0

我想知道如何仅在文件包含特定文本时才继续构建?仅当文件包含特定文本时才构建

如果文本不正确,我想构建失败,否则继续构建。

+0

那么你的Jenkinsfile像这么远?你有什么尝试? – burnettk

+0

文件位于作业配置为运行的虚拟机上。我有一个shell脚本来检查内容。 – kumar

回答

1

更新您的脚本以在文件不包含文本时返回非零退出状态。通过sh一步像这样运行你的shell脚本:

sh '/path/to/your/script_that_checks_another_file_for_certain_text.sh' 

全管道:

pipeline { 
    agent { label 'docker' } 
    stages { 
    stage('build') { 
     steps { 
     sh '/path/to/your/script_that_checks_another_file_for_certain_text.sh' 
     echo 'this will not happen if the above script returns a bad exit status' 
     } 
    } 
    } 
} 
相关问题