3

我有一個Jenkins Pipeline plugin腳本看起來像這樣:詹金斯流水線插件看似跳過命令

stage("check out project") { 
    shell "pwd" 
    echo "test 1" 
    git credentialsId: "user", url: "http://url/project" 
    echo "test 2" 
    shell "git --version" 
    echo "test 3" 
} 

生成的輸出是這樣的:

[Pipeline] stage 
[Pipeline] { (check out project) 
[Pipeline] echo 
test 1 
[Pipeline] echo 
test 2 
[Pipeline] echo 
test 3 
[Pipeline] } 
[Pipeline] // stage 
[Pipeline] End of Pipeline 
Finished: SUCCESS 

從輸出,只有構建時間判斷echo命令被執行。所有其他人都被忽略。似乎沒有錯誤發生。

如何獲得所有要執行的命令?

+0

你檢查看看是否有一個工作區git clone/pull? –

回答

1

你的腳本成功運行,如預期後

  1. 使用sh這一翻譯的shell

像這樣與node{ }

  • 圍繞它的工作:

    node{ 
        stage("check out project") { 
         sh "pwd" 
         echo "test 1" 
         git credentialsId: '12341234-1234-1234-1234-123412341234', url: "[email protected]:sendgrid/sendgrid-java.git" 
         echo "test 2" 
         sh "git --version" 
         echo "test 3" 
        } 
    } 
    
  • +0

    使用'sh'命令確實有幫助,但Git仍然無法正常工作。 :-( –

    +0

    看起來'git'不工作,因爲我們正在使用一個太新版本的管道插件(2.3)和一箇舊版本的Git插件(2.4.4):https:// issues。 jenkins-ci.org/browse/JENKINS-35247 –