php-fpm git jenkins,关于php:在Jenkins中找不到私人git子模块

问题

我正在尝试在Jenkins中构建我的应用程序,它在Github的私有仓库中,还有一个私有子模块。

我可以通过设置凭据来在Jenkins中克隆私有存储库,但是Jenkins无法克隆子模块,这是构建失败的输出:

Started by an SCM change

Building in workspace /var/lib/jenkins/jobs/Project/workspace

Fetching changes from the remote Git repository

Fetching upstream changes from git@github.com:user/repogit

using GIT_SSH to set credentials

Checking out Revision 9cc99b67cc676d0ea8ccd489a8327f5c6dbb8d7f (origin/branch)

[workspace] $ /bin/sh -xe /tmp/hudson2710403018107019432.sh

+ git submodule update --init --recursive

Initialized empty Git repository in /var/lib/jenkins/jobs/repository/submodule/.git/

ERROR: Repository not found.

fatal: The remote end hung up unexpectedly

Clone of 'git@github.com:user/submodule.git' into submodule path 'repository/submodule/' failed

Build step 'Execute shell' marked build as failure

Discard old builds...

#156 is removed because status FAILURE is not to be keptPublishing Clover coverage report...

No Clover report will be published due to a Build Failure

Sending e-mails to:

Finished: FAILURE

这就是我在詹金斯试图做的

试图将其他行为设置为"高级子模块行为",但没有成功。

尝试在使用phpunit运行测试之前设置一个新步骤:

git submodule update --init --recursive

试图在我的子模块的项目上设置一个git存储库,不仅仅是正在测试的主存储库,也没有运气。

所有这些都会导致错误,指出Jenkins找不到子模块的存储库。

关于如何解决这个问题的任何想法?

(用户名,路径和存储库是正确的,我只是将它们更改为在此处发布)

解决了。 在我的凭证中,我使用的是直接SSH密钥(选项"直接输入"),而不是放入文件中。

我只是将密钥(公共密钥和私有密钥)放在?/ .ssh中,并将凭据更改为选项"来自Jenkins主?/ .ssh"。

问题在于子模块未使用我为主存储库指定的凭据,而是试图使用默认的ssh密钥(.ssh / id_rsa)。

另一个解决方案是将-i my_key传递给git子模块步骤(仅当您的密钥不在默认路径(?/ .ssh / id_rsa)中时才需要此命令)

另外,不要忘记为您的密钥赋予正确的权限,在我的情况下,我必须:

chown apache ~/.ssh/id_rsa*

chmod 700 ~/.ssh/id_rsa*

那么,有没有办法使用直接输入?

不是我发现的..这是我让它工作的唯一方法。

确认后,密钥必须位于具有默认名称(id_rsa和id_rsa.pub)的文件中。 如果为.ssh / config文件中的文件指定了非标准名称,则初始克隆成功,但是子模块更新失败。

很高兴这对您有帮助@BitByteDog :)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值