gpt4 book ai didi

git - Jenkins 管道私有(private)存储库依赖

转载 作者:太空狗 更新时间:2023-10-29 14:16:57 26 4
gpt4 key购买 nike

我在一个存储库中有一个 Jenkins 管道,这个存储库的 package.json 依赖于另一个存储库(两者都是 Bitbucket 私有(private)存储库)。当我在本地执行 yarn install 时,它运行良好,但在 jenkins 中它失败并出现此错误:

yarn install v1.2.1
[1/5] Validating package.json...
[2/5] Resolving packages...
error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads ssh://git@bitbucket.org/user/repo.git
Directory: /var/lib/jenkins/workspace/s_repo_branch-
YJRVO7LRN3U452ZV2XNZJUB35FGSW2NXEAUPBCDKUVTKUFAHHBDA
Output:
Permission denied (publickey).
fatal: Could not read from remote repository.

我在主机上添加了 ssh key ,添加为扫描组织文件夹的 jenkins 凭据(使用 Bitbucket Branch Source 插件),并在两个 bitbucket 项目中也添加了 key 。另一个项目(没有依赖项)的管道工作正常,所以我认为这不是 ssh key 的问题。 package.json 中的依赖行如下所示:

"repo": "ssh://bitbucket.org/user/repo.git#develop"

也试过

"repo": "git+ssh://bitbucket.org/user/repo.git#develop"

有人遇到过类似的问题吗?

最佳答案

When I do the yarn install in local, it works perfectly, but in jenkins it's fails

这是典型的 git,它不会在您期望的地方搜索(应该在运行 Jenkins/.ssh 的帐户中)

调试此问题的一个好方法是设置变量 GIT_SSH_COMMAND=ssh -v(带有 JENKINS EnvInject Plugin )以便查看,每当使用 ssh 协议(protocol)调用 git 时,使用了哪些 key .

OP 添加:

I have chosen to delete the passphrase from the ssh key and it works correctly.

这表明 ssh-agent将缓存密码的缓存在用户帐户中运行,但不在 Jenkins 帐户中。

关于git - Jenkins 管道私有(private)存储库依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47017874/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com