我配置了一个Jenkins多分支管道,该管道应该从远程GIT存储库中获取源代码以进行构建。 Jenkins (Jenkins)似乎“随机”选择了该构建的旧提交,并在构建日志文件中显示了消息“多个候选修订版”。

我的管道看起来像:

checkout(
        [
            $class: 'GitSCM',
            branches: [[name: "release/0.0.1"]],
            doGenerateSubmoduleConfigurations: false,
            extensions: [
                [$class: 'MessageExclusion', excludedMessage: '(?s)^\\[DOC\\] Robot.*']
            ],
            submoduleCfg: [],
            userRemoteConfigs: [[credentialsId: 'xxx', url: "https://somerepo.net/scm/someproject/somecomponent.git"]]
        ]
    )

Jenkins的日志文件显示:
[Pipeline] checkout
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url https://somerepo.net/scm/someproject/somecomponent.git # timeout=10
Fetching upstream changes from https://somerepo.net/scm/someproject/somecomponent.git
 > git --version # timeout=10
using GIT_ASKPASS to set credentials
 > git fetch --tags --progress https://somerepo.net/scm/someproject/somecomponent.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse release/0.0.1^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/release/0.0.1^{commit} # timeout=10
Multiple candidate revisions
Checking out Revision 301c954e576bd3f03ef787563f159d541cb6e8d2 (release/0.0.1)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 301c954e576bd3f03ef787563f159d541cb6e8d2
Commit message: "Some old commit message"
 > git rev-list --no-walk 88be7349bd7b6ddb0654325e6b07cf1da2f8a35b # timeout=10

在日志文件中,我可以看到Jenkins使用的是发行版/0.0.1中的旧修订版301c954e576bd3f03ef787563f159d541cb6e8d2,而不是refs/remotes/origin/release/0.0.1中的新远程88be7349bd7b6ddb0654325e6b07cf1da2f8a35b。

任何想法出什么事了吗?

最佳答案

我不是git大师,但请尝试指定

分支机构:[[名称:“*/release/0.0.1”]],

代替

分支机构:[[名称:“版本/0.0.1”]],

09-26 20:40
查看更多