Cloud Build不会填充Git子模块。

huangapple go评论68阅读模式
英文:

Cloud Build does not populate Git submodules

问题

我有一个Google Cloud Build触发器,我已将其设置为一个具有选项Cloud Build配置文件(yaml或json)的GitHub存储库。

该存储库有一个子模块,但我担心子模块默认情况下未被填充。当我从Cloud Build进程的结果Docker映像创建计算VM时,日志显示:

DEFAULT 2023-05-22T01 [resource.labels.instanceId: XXX-build] ImportError: cannot import name 'mysubmodule' from 'mysubmodule' (unknown location)

我认为问题在于子模块不像在桌面上使用git clone时那样拉取。因此,我在下面的cloudbuild.yaml文件中添加了git submodule update --init命令,但问题是Cloud Build进程不理解子模块命令。

我尝试过:

  • 更改SSH gitpath的路径:https://stackoverflow.com/questions/43437909/cloud-build-failing-on-git-submodules
  • 在cloudbuild.yaml中添加git命令:
- name: "gcr.io/cloud-builders/git"
  args:
    - submodule update --init --recursive

结果

Step #0: git: 'submodule update --init --recursive'不是git命令。请参阅'git --help'。

还有这个错误:https://issuetracker.google.com/issues/123060361

英文:

I have a Google Cloud Build trigger which I've set to a Github repo which has the option selected Cloud Build configuration file (yaml or json).

The repo has a submodule but I'm afraid the submodule is not populated by default. When I create a Compute VM from the resulting Docker image from the Cloud Build process, the logs show:

DEFAULT 2023-05-22T01 [resource.labels.instanceId: XXX-build] ImportError: cannot import name 'mysubmodule' from 'mysubmodule' (unknown location)  

I believe the issue is the submodules do not pull like when using git clone on a desktop. So I add the git submodule update --init command in the cloudbuild.yaml file below but the issue is the Cloud Build process doesn't understand the submodule command.

I've tried:

There is also this bug: https://issuetracker.google.com/issues/123060361

答案1

得分: 0

由于子模块功能尚未可用,您面临了错误。您提到的问题跟踪器仍然是开放的,这个功能的进展可以在那里追踪。您可以在那里提出您的问题并为问题跟踪器点赞。

在同一个问题跟踪器中提到了一个解决方法,可能会对您有所帮助。另外,请查看这个GitHub链接,可能也会有所帮助。

英文:

As sub modules feature is not available yet you are facing the errors.And the issue tracker which you have mentioned is still open and further progress for this feature can be tracked there.You can raise your concern there and upvote the issue tracker.

There is work around mentioned at same issue tracker which might help you.Additionally check out this github link that might help.

huangapple
  • 本文由 发表于 2023年5月22日 09:47:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302618.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定