簡體   English   中英

Jenkins文件-一條管道中的多倉庫

[英]Jenkins File - Multi repo in one pipeline

我正在使用DIR()為我簽出的多倉庫創建目錄。 顯然,它沒有任何有意義的錯誤。

這是我的JenkinsFile片段

try {
    withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: "$GIT_CRED"]
                ]) {

      stage ('Checkout LLM')  { 
        try {
         dir('LLMC')
           git poll: true , branch: "${GIT_BRANCH}", credentialsId: "${GIT_CRED}", url: "${GIT_REPO}"
           echo "checking out"
           sh "ls -l"
           sh "pwd"

        }catch(error) {
              echo "## ERROR- 'Git checkout failed'.exiting"
              sh "exit 1"
              throw error
        }
                        }

錯誤:

Running in /home/jenkins/workspace/Dev-Pipelines/LLM-engine/LLMC
[Pipeline] dir
[Pipeline] echo
## ERROR- 'Git checkout failed'.exiting
[Pipeline] sh
[LLM-engine] Running shell script
+ exit 1
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] echo
## Outer catch caught error. Exiting...
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

它創建了一個新目錄,但在簽出時失敗。 使用out dir()塊可以正常工作。 如何啟用調試?

我通過在dir語句中使用花括號來修復它。

    try {
     dir('LLMC')
      {
       git poll: true , branch: "${GIT_BRANCH}", credentialsId: "${GIT_CRED}", url: "${GIT_REPO}"
       echo "checking out"
       sh "ls -l"
       sh "pwd"
      }
    }catch(error) {

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM