How to load public submodules in a private repo?
I have current appveyor build of a private repo which has just added a submodule reference to a public repo.
When the build kicks off and the private repo is cloned, the submodule is not cloned and the build fails.
I added an install
command to initialize the submodule
install:
- git submodule update --init --recursive
<pre><code>
When the `install` phase runs, my build fails with `fatal: not a git repository (or any of the parent directories): .git`
It appears that appveyor is not fetching the parent repo as a git repo, but instead pulls the ZIP of parent repo from GitHub and extracts the ZIP into the project working folder, without the hidden `.git` subfolder that would allow the submodule command to work.
I am currently working around this by explicitly cloning the submodule into the desired parent path, but that is a problematic hack.
I found [this doc page](https://www.appveyor.com/docs/how-to/private-git-sub-modules/) which describes how to access a *private* submodule reference, but in my scenario, the submodule is a public repo, accessible to all, so no SSH key setup should be required. However, that page also implies the install command as above, which just won't work without the magic `.git` folder of the parent.
How can submodules be resolved in an appveyor build?
Is my PR build failure because the first PR which includes the submodule has not actually been merged into the parent? (I don't like merging a failing build, but maybe submodules require a bootstrap?)</code>
</pre>
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 19 May, 2020 08:38 PM
Hi Doug,
Make sure you don't have "shallow clone" enabled.
2 Posted by doug.schmidt on 19 May, 2020 09:00 PM
Yep, I do have shall clone enabled!
And I just realized why (having shallow clone meant not having to add an SSH key to access the parent repo, which is private)
So I will follow the guidance on https://www.appveyor.com/docs/how-to/private-git-sub-modules/ for adding an SSH key via a secure variable, and then disabled shallow clone.
Thanks
Support Staff 3 Posted by Feodor Fitsner on 20 May, 2020 04:09 PM
Or, alternatively, you can authorize AppVeyor to GitHub as "AppVeyor" GitHub App - this way the repo will be cloned via HTTPS, not SSH.
4 Posted by doug.schmidt on 20 May, 2020 05:12 PM
Thanks Feodor. We are planning to migrate to the AppVeyor GitHub App for authorization tomorrow.
5 Posted by doug.schmidt on 22 May, 2020 05:30 PM
We made the following changes:
- switched our authorization mode from the older OAuth to the newer AppVeyor GitHub app - changed the submodule reference from an SSH URL to an HTTPS URL. - disabled shallow clone
Now the
- git submodule update --init --recurserve
command in theinstall:
section is working perfectly.Thanks for your guidance on this.
Support Staff 6 Posted by Feodor Fitsner on 23 May, 2020 03:43 AM
Cool, thanks for the update!
Feodor Fitsner closed this discussion on 23 Jul, 2020 09:02 PM.