Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell Jenkins管道插件似乎在跳过命令_Shell_Jenkins_Groovy_Continuous Integration_Jenkins Pipeline - Fatal编程技术网

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 of
    shell
  • 像这样:

    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):