小编oha*_*eck的帖子

Jenkins多分支管道中带有BitBucket Notifier的“ java.lang.Exception:无或多个存储库”

我在Jenkins上有一个多分支的声明性管道,该管道由我的Bitbucket云帐户中的回购事件触发,我希望它可以将结果报告给Bitbucket。

我的Jenkinsfile看起来如下:

pipeline {
    agent any
    stages {
        stage('Prepare Env') {
            steps {
                bitbucketStatusNotify(buildState: 'INPROGRESS')
                sh "npm i"
            }
            post {
                success {
                    bitbucketStatusNotify(buildState: 'SUCCESSFUL')
                }
                failure {
                    bitbucketStatusNotify(buildState: 'FAILED')
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我发现,当Jenkins构建失败并通过消息向Bitbucket通知构建结果时,对拉取请求的第二次及所有连续提交都会导致出现这种情况java.lang.Exception: None or multiple repos

这在某种程度上与日志中的第一行说:Fetching changes from 2 remote Git repositories

但是,我实际上只有一个存储库,不知道为什么詹金斯将其识别为多个存储库。

如何使我的构建停止看到多个存储库并成功?

完整日志如下:

Branch event
Checking out git https://bitbucket.org/mycompany/myproject.git https://bitbucket.org/mycompany/myproject.git into /var/lib/jenkins/workspace/myproject_PR-48-TV7ILAHCKATC6ZK26DHNTXI6KKLEGO3RSNDKAL2363W5GU5TABFQ@script to read Jenkinsfile
 > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from 2 remote Git repositories
 > …
Run Code Online (Sandbox Code Playgroud)

git bitbucket jenkins jenkins-pipeline bitbucket-cloud

3
推荐指数
1
解决办法
443
查看次数