本文介绍了具有“多个候选修订版”的詹金斯管道并正在挑选旧的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



我的管道看起来像:

 结帐(
[
$ class:'GitSCM',
分支机构:[[名称: release / 0.0.1]],
doGenerateSubmoduleConfigurations:false,
扩展名:[
[$ class:'MessageExclusion',excludeedMessage:'(?s)^ \\ [DOC\\] Robot。*']
],
submoduleCfg:[],
userRemoteConfigs:[[credentialsId:'xxx',网址: https:// somerepo。 net / scm / someproject / somecomponent.git]]
]

Jenkins的日志文件显示:

  [管道]结帐
> git rev-parse --is-inside-work-tree#timeout = 10
从远程Git存储库
>中获取更改。 git config remote.origin.url https://somerepo.net/scm/someproject/somecomponent.git#timeout = 10
从https://somerepo.net/scm/someproject/somecomponent.git $获取上游更改b $ b> git --version#timeout = 10
使用GIT_ASKPASS设置凭据
> 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
多个候选修订版
检出修订版301c954e576bd3f03ef787563f159d541cb6e8d2(发行版/0.0.1)
> ; git config core.sparsecheckout#timeout = 10
> git checkout -f 301c954e576bd3f03ef787563f159d541cb6e8d2
提交消息:某些旧的提交消息
> git rev-list --no-walk 88be7349bd7b6ddb0654325e6b07cf1da2f8a35b#timeout = 10

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


$

解决方案

我不是git guru,但尝试指定



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



而不是



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


i have a Jenkins multibranch Pipeline configured which should fetch sources from a remote GIT repository for a build. Jenkins no seems to "randomly" pick an old commit for the build an showing the message "Multiple candidate revisions" in Build log files.

My Pipeline is looking like:

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"]]
        ]
    )

Log file from Jenkins shows:

[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

In the log file I can see that Jenkins is using the old revision 301c954e576bd3f03ef787563f159d541cb6e8d2 from release/0.0.1 instead of the new remote 88be7349bd7b6ddb0654325e6b07cf1da2f8a35b from refs/remotes/origin/release/0.0.1.

Any ideas whats going wrong here?

解决方案

I am not a git guru, but try specifying

branches: [[name: "*/release/0.0.1"]],

instead of

branches: [[name: "release/0.0.1"]],

这篇关于具有“多个候选修订版”的詹金斯管道并正在挑选旧的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 22:45