2017-05-03 73 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' 
     } 
    } 
    } 
} 
相關問題