Git Jenkins在部署子模块时出错

Git Jenkins在部署子模块时出错,git,jenkins,Git,Jenkins,我正在尝试设置Jenkins来部署位于GIT服务器上的Wordpress网站。 一切进展顺利,直到我发现它没有构建项目,包括我们用于主题和插件的子模块 当我将我认为正确的命令添加到Jenkins文件时,我得到了以下错误。 这是在它已经通过了11个其他子模块之后,这些子模块的设置方式与失败的子模块完全相同 [Pipeline] End of Pipeline [Bitbucket] Notifying commit build result [Bitbucket] Build result n

我正在尝试设置Jenkins来部署位于GIT服务器上的Wordpress网站。 一切进展顺利,直到我发现它没有构建项目,包括我们用于主题和插件的子模块

当我将我认为正确的命令添加到Jenkins文件时,我得到了以下错误。 这是在它已经通过了11个其他子模块之后,这些子模块的设置方式与失败的子模块完全相同

[Pipeline] End of Pipeline

[Bitbucket] Notifying commit build result

[Bitbucket] Build result notified

hudson.plugins.git.GitException: Command "git config --get submodule.mysubmodule.url" returned status code 1:

stdout: 

stderr: 

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2380)

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2376)

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1923)

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommand(CliGitAPIImpl.java:1935)

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getSubmoduleUrl(CliGitAPIImpl.java:1512)

    at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$7.execute(CliGitAPIImpl.java:1431)

    at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:161)

Caused: java.io.IOException: Could not perform submodule update

    at hudson.plugins.git.extensions.impl.SubmoduleOption.onCheckoutCompleted(SubmoduleOption.java:166)

    at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1342)

    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:125)

    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)

    at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)

    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)

    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)

    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

    at java.base/java.lang.Thread.run(Thread.java:834)

Finished: FAILURE
我现在不知道是什么引起的。 我在jenkins的配置中添加了“高级子模块行为”,并选择了“使用来自父存储库默认远程的凭据”。 没有这一点,它就不会起作用

以下是我的文件:

pipeline {
    agent any

    stages {

        stage('Prepare') {
            steps {
                echo 'Get submodules'
                sh 'git submodule update --init'
                echo 'Get Composer'
                sh 'bash ./get-composer.sh'
                sh 'php composer.phar clear-cache'
            }
        }

        stage('Build') {
            steps {
                sh 'php composer.phar install --no-dev --classmap-authoritative --no-progress'
                sh 'rm composer.phar'
                sh 'mkdir cache'
            }
        }

        stage('Test') {
            steps {
                echo 'We will be testing in this stage'
            }
        }

        stage('Staging' ){
            when {
                anyOf {
                    branch 'master';
                    changelog '#deploytest'
                }
            }
            steps {
                echo 'deploying to website-to-deplay.com'
                sh 'ls -la ./'
                sh 'rsync -av -e ssh --exclude-from="exclude-list.txt" --delete ./ user@xxx.xx.x.xx:/var/www/Website-to-deploy.com/public_html/'
            }
        }
    }
}
可以肯定的是,如果没有子模块init,脚本可以完美地工作。 没有任何问题。 它只是在子模块部分崩溃

我检查了子模块的git repo是否失败:

  • 存在,它确实存在
  • 设置与工作的once相同
  • 提交没有损坏,并且确实执行了新的提交
.gitmodules文件的设置如下(添加另外两个子模块进行比较,最后一个子模块崩溃)

如果你知道问题是什么,那就太好了。 在谷歌上输入错误时,我找到的所有答案都不起作用

希望你能帮忙。 干杯

[submodule "WordpressPlugin9"]
    path = wp-content/plugins/plugin9
    url = http://jenkinsserver:7990/scm/wpplug/plugin9.git
[submodule "wordpressPlugin10"]
    path = wp-content/plugins/plugin10
    url = http://jenkinsserver:7990/scm/wpplug/plugin10.git
[submodule "CrashingWordpressPlugin11"]
    path = wp-content/plugins/crashing-plugin11
    url = http://jenkinsserver:7990/scm/wpplug/crashing-plugin11.git