1

我使用 IBM 的 LSF 工作负载管理平台在 Jenkins 之外克隆到某个共享文件夹

或者假设我从命令行手动克隆

然后我想使用 GIT 插件提取更新的更改(提交)和结帐分支

它可以工作,但需要与完整克隆相同的时间。意味着需要 5-7 分钟而不是 20 秒

你能解释一下这种行为吗?我该如何处理?

我从命令行创建的本地存储库功能齐全。我想在 20 秒内结帐

谢谢

代码:

stage('checkout') {
    steps {
     script {
     node('linux4') {
     ws("/comm/data_10/some_folder") {
     
       // Git plugin will not pull submodules with --force option,
       // if there are local changes it fails the CI (JENKINS-27625, JENKINS-55875).
       sh "git submodule foreach --recursive git reset --hard || true"
     
       checkout([
         $class: 'GitSCM',
         branches: [[name: "develop"]],
         doGenerateSubmoduleConfigurations: false,
         extensions: [[$class: 'CheckoutOption', timeout: 25 ], 
           [$class: 'SubmoduleOption',
               disableSubmodules: false,
               parentCredentials: false,
               recursiveSubmodules: true,
               reference: '',
               trackingSubmodules: true]],
               userRemoteConfigs: [[credentialsId: env.CRED, url: env.REPO]]
       ])
}}}}}

日志(我将调试变量添加为 hudson.plugins.git.GitSCM.verbose=true)。结帐耗时 6 分钟:

10:40:29  Using checkout strategy: Default
10:40:29  Last Built Revision: Revision 7588941db5123456975ff1234567ef8733f20b0b (origin/develop)
10:40:29  The recommended git tool is: NONE
10:40:29  using credential f76306ee-b3d1-4169-9582-123467
10:40:29  Fetching changes from the remote Git repository
10:40:28   > git rev-parse --is-inside-work-tree # timeout=10
10:40:28   > git config remote.origin.url <removed_remote_URL> # timeout=10
10:40:28  Fetching upstream changes from <removed_remote_URL>
10:40:28   > git --version # timeout=10
10:40:28   > git --version # 'git version 2.28.1'
10:40:28  using GIT_ASKPASS to set credentials SIRC DevOps
10:40:28   > git fetch --tags --progress -- git@gitlab-srv:CDE-Users/HW_ALG.git +refs/heads/*:refs/remotes/origin/* # timeout=10
10:40:31  getCandidateRevisions(false,develop,,,hudson.plugins.git.util.BuildData@18b394fa[scmName=<null>,remoteUrls=[<removed_remote_URL>],buildsByBranchName={origin/develop=Build #31 of Revision 7588941db57d8597975ff98bb3d7ef8733f20b0b (origin/develop)},lastBuild=Build #31 of Revision 7588941db57d8597975ff98bb3d7ef8733f20b0b (origin/develop)]) considering branches to build
10:40:31  Qualifying develop as a branch in repository origin -> origin/develop
10:40:31  rev-parse origin/develop -> AnyObjectId[7588941db5123456975ff1234567ef8733f20b0b]
10:40:31  Found a new commit AnyObjectId[7588941db5123456975ff1234567ef8733f20b0b] to be built on origin/develop
10:40:31  Checking out Revision 7588941db5123456975ff1234567ef8733f20b0b (origin/develop)
10:40:30   > git rev-parse origin/develop^{commit} # timeout=10
10:40:30   > git config core.sparsecheckout # timeout=10
10:40:30   > git checkout -f 7588941db5123456975ff1234567ef8733f20b0b # timeout=25
10:46:37  Commit message: "Merge branch '__branch_name_removed__' into 'develop'"
10:46:36   > git rev-list --no-walk 7588941db5123456975ff1234567ef8733f20b0b # timeout=10

环境:操作系统Linux。Git 作为 Docker 容器运行

在版本上测试:

Jenkins 2.164.1 git 插件 3.9.3 和 Jenkins 2.263.1 git 插件 4.5.1

4

0 回答 0