Jenkins 多分支管道中的 GitLab 插件问题 - URL 编码问题

问题描述 投票:0回答:1

我们正在为 SFDX 项目建立 CI/CD 管道流程。 我们使用 GitLab 作为我们的源代码存储库。 和 Jenkins - 用于部署的多分支管道项目。

我在 Jenkins 多分支管道设置中遇到了 GitLab 插件问题。当尝试使用 SSH 密钥身份验证克隆我的 GitLab 项目时,我在“checkout scm”命令的管道脚本中遇到错误。错误日志指示 Git URL 编码不正确的问题。这是错误日志供参考:

Selected Git installation does not exist. Using Default
The recommended git tool is: NONE
using credential id_ed25519
 > C:\Program Files\Git\bin\git.exe rev-parse --resolve-git-dir D:\Jenkins\workspace\LI-DevOps_main@2\.git # timeout=10
Fetching changes from the remote Git repository
 > C:\Program Files\Git\bin\git.exe config remote.origin.url %[email protected]:22222]:akashkhichi/salesforceproject.git # timeout=10
Fetching without tags
Fetching upstream changes from %[email protected]:22222]:akashkhichi/salesforceproject.git
 > C:\Program Files\Git\bin\git.exe --version # timeout=10
 > git --version # 'git version 2.22.0.windows.1'
 > C:\Program Files\Git\bin\git.exe fetch --no-tags --force --progress -- %[email protected]:22222]:akashkhichi/salesforceproject.git +refs/heads/main:refs/remotes/origin/main # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from %[email protected]:22222]:akashkhichi/salesforceproject.git

似乎 SSH URL 即 [[email protected]:22222]:akashkhichi/salesforceproject.git 正在编码为 %[email protected]:22222]:akashkhichi/salesforceproject.git

我们已经验证了 GitLab URL 的配置。而且 SSH 密钥也工作正常。

在尝试解决该问题时,我验证了 GitLab URL 的配置设置,并确保 SSH 密钥配置正确且正常运行。我还检查了 Jenkins 多分支管道配置,以确保正确设置与 GitLab 集成相关的所有设置。

我们已经尝试使用 Git 插件来完成相同的流程,效果很好,但我们必须使用 GitLab 插件来利用它的功能。

jenkins ssh gitlab jenkins-pipeline checkout
1个回答
0
投票
带有方括号的存储库网址的

类似 scp 的语法不太受欢迎,它的使用会导致您所描述的问题。我建议改用更常见的ssh://

风格:

ssh://[email protected]:22222/akashkhichi/salesforceproject.git
    
© www.soinside.com 2019 - 2024. All rights reserved.