Docker Hub和git子模块 [英] Docker Hub and git submodules

查看:76
本文介绍了Docker Hub和git子模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用git子模块的存储库,并且在Docker Hub上配置了自动构建.在构建过程的开始,似乎Docker Hub从默认分支(主服务器)中提取了存储库,更新了子模块,然后签出到触发了构建的特定分支(例如分支Feature-a).如果feature-a分支具有与master完全相同的子模块,则工作正常,但是如果子模块不同(例如,从另一个存储库中拉出一个子模块),则构建会失败.

I have a repository that uses git submodules, and I configured the automated build on Docker Hub. At the beginning of the build process, it looks like Docker Hub pulls the repository from the default branch (master), update submodules and then checkout to the particular branch (let's say branch feature-a) that triggered the build. It works fine if feature-a branch has the very same submodules as master, but if the submodules are different (let's say, pull one submodule from a different repo), the build fails.

有没有办法使Docker Hub直接克隆正确的分支?

Is there a way to make Docker Hub clone the correct branch directly?

推荐答案

您需要使用钩子: TL; DR:将其放置在 hooks/post_checkout 中:

TL;DR: Place this in hooks/post_checkout:

#!/bin/bash
# Docker hub does a recursive clone, then checks the branch out,
# so when a PR adds a submodule (or updates it), it fails.
git submodule update --init

这篇关于Docker Hub和git子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆