admin管理员组文章数量:1198783
Background:
- a number of codependent projects, projA and projB
- each project can build separately, in a docker instance. A build script starts a docker instance, mounting the project's root in the instance, then running other build steps.
- a project may use git information into the build, e.g. from
git describe
.
The projects build fine, and find their relevant git information.
Next step, tying the projects into a larger one. Enters the umbrella project projU, with projA and projB as submodules.
projU
+ projA
+ projB
ProjU attempts to use the submodules' own build scripts. Again, these start a docker instance, for which they mount their own project root.
The issue is that, unlike when it is its own clone, projA as a submodule does not own its .git
directory. Since it mounts its root in a docker instance, it does not have access to its parent. Therefore, git describe
fails.
I would like a smooth way to support building both as a submodule, and as a separate repo. Some alternatives that come to mind:
- find a way to make git save the .git dir under each submodule. As far as I recall, that's how submodules worked once upon a time. I could not find a way to do that today.
- don't use actual submodules in projB, just write a script that makes separate clones in subdirectories.
- save the required git info for submodules from projU, and pass that as envvars when starting the docker instances for projA and projB
- create and maintain alternative build scripts in projU, to build the submodules with mounting the whole projU in docker, instead of the submodules' roots.
Right now, I find that the more pragmatic approach, also avoiding redundant scripts, would be 2. Number 1 would work too, but I don't have much hope that this is feasible.
Any other more adequate approches?
本文标签: dockerAccess git data from a submodulewhich lacks access to its parentStack Overflow
版权声明:本文标题:docker - Access git data from a submodule, which lacks access to its parent - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738570773a2100583.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论