Shell Jenkins管道插件似乎在跳过命令
我有这样一个脚本:Shell Jenkins管道插件似乎在跳过命令,shell,jenkins,groovy,continuous-integration,jenkins-pipeline,Shell,Jenkins,Groovy,Continuous Integration,Jenkins Pipeline,我有这样一个脚本: 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" } node{ stage("check out project") { sh "pwd"
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"
}
node{
stage("check out project") {
sh "pwd"
echo "test 1"
git credentialsId: '12341234-1234-1234-1234-123412341234', url: "git@github.com:sendgrid/sendgrid-java.git"
echo "test 2"
sh "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命令。其他的都被忽略了。似乎没有发生错误
如何执行所有命令?您的脚本成功运行,并在运行后按预期工作
节点{}
和sh
interead ofshell
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"
}
node{
stage("check out project") {
sh "pwd"
echo "test 1"
git credentialsId: '12341234-1234-1234-1234-123412341234', url: "git@github.com:sendgrid/sendgrid-java.git"
echo "test 2"
sh "git --version"
echo "test 3"
}
}
您是否检查了工作区以查看是否存在git克隆/拉取?使用
sh
命令确实有帮助,但git仍然无法工作:-(看来,git
不起作用,因为我们使用的是太新版本的管道插件(2.3)和太旧版本的git插件(2.4.4):