[Feature] recursive clone for git submodules #289

Closed
opened 2025-10-31 15:07:38 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @Selovert on GitHub (Apr 15, 2025).

I've got a build that is done from a repo with a submodule. Looks like the submodule is not being cloned in at the time of build, which breaks things.

Would also be fine with a workaround if one exists!

Originally created by @Selovert on GitHub (Apr 15, 2025). I've got a build that is done from a repo with a submodule. Looks like the submodule is not being cloned in at the time of build, which breaks things. Would also be fine with a workaround if one exists!
Author
Owner

@Ga22be commented on GitHub (Jun 8, 2025):

Agreed, I just hit this issue while setting up a stack.

First I figured that just adding the submodule sync and update as commands in the pre-deploy commands could suffice, but this misses out on the repository token and fails on authorization.

Having looked at the code I figure that an additional step in the pull.rs file is probably the way to go. I'm not a rust developer however so making a PR isn't trivial. Maybe check that a .gitmodules exists before doing any submodule stuff.

@Ga22be commented on GitHub (Jun 8, 2025): Agreed, I just hit this issue while setting up a stack. First I figured that just adding the submodule sync and update as commands in the pre-deploy commands could suffice, but this misses out on the repository token and fails on authorization. Having looked at the code I figure that an additional step in the `pull.rs` file is probably the way to go. I'm not a rust developer however so making a PR isn't trivial. Maybe check that a `.gitmodules` exists before doing any submodule stuff.
Author
Owner

@jochemvangrondelle commented on GitHub (Jun 29, 2025):

Upvoting this - komo.do is amazing!
Ideal setup is separate repos for each server with gpg and pubkeys, but then having them added as submodules to one bigger repo for Komodo that can also include common resource configs across services. But not a blocker - can work with separate repos, but if it's an easy fix to fetch recursively, would be already amazing, and then pushing changes directly to the nested submodules even more cool.

@jochemvangrondelle commented on GitHub (Jun 29, 2025): Upvoting this - komo.do is amazing! Ideal setup is separate repos for each server with gpg and pubkeys, but then having them added as submodules to one bigger repo for Komodo that can also include common resource configs across services. But not a blocker - can work with separate repos, but if it's an easy fix to fetch recursively, would be already amazing, and then pushing changes directly to the nested submodules even more cool.
Author
Owner

@Ga22be commented on GitHub (Jun 29, 2025):

I did solve my issue in the end by removing my submodule and adding a separate repo in the komodo interface which I then reference by path in my stack config. I do not get the ability to lock the "submodule" revision in git the same way, which has caused some headaches. So it is not nearly as clean but a workable workaround in the mean time. I'd still love submodule support to be added when convenient.

@Ga22be commented on GitHub (Jun 29, 2025): I did solve my issue in the end by removing my submodule and adding a separate repo in the komodo interface which I then reference by path in my stack config. I do not get the ability to lock the "submodule" revision in git the same way, which has caused some headaches. So it is not nearly as clean but a workable workaround in the mean time. I'd still love submodule support to be added when convenient.
Author
Owner

@mbecker20 commented on GitHub (Jul 1, 2025):

Agreed, I just hit this issue while setting up a stack.

First I figured that just adding the submodule sync and update as commands in the pre-deploy commands could suffice, but this misses out on the repository token and fails on authorization.

Having looked at the code I figure that an additional step in the pull.rs file is probably the way to go. I'm not a rust developer however so making a PR isn't trivial. Maybe check that a .gitmodules exists before doing any submodule stuff.

You can add your git access token as a Variable or Secret, and use it in the Pre Deploy / On Clone commands via interpolation, for example https://token:GIT_TOKEN@github.com/.../...

@mbecker20 commented on GitHub (Jul 1, 2025): > Agreed, I just hit this issue while setting up a stack. > > First I figured that just adding the submodule sync and update as commands in the pre-deploy commands could suffice, but this misses out on the repository token and fails on authorization. > > Having looked at the code I figure that an additional step in the `pull.rs` file is probably the way to go. I'm not a rust developer however so making a PR isn't trivial. Maybe check that a `.gitmodules` exists before doing any submodule stuff. You can add your git access token as a Variable or Secret, and use it in the Pre Deploy / On Clone commands via interpolation, for example https://token:[[GIT_TOKEN]]@github.com/.../...
Author
Owner

@Ga22be commented on GitHub (Jul 14, 2025):

For anyone else wanting to work around this I suggest the following in the Pre Deploy hook of your stack. All based on @mbecker20's suggestion. Kudos!

git config submodule.<path-to-submodule>.url https://token:[[YOUR_SECRET]]@github.com/org/submodule-repo.git
git submodule update --init --recursive

This will overwrite your submodule URL and allow you to use a secret that you have specified in the Komodo secret store.

@Ga22be commented on GitHub (Jul 14, 2025): For anyone else wanting to work around this I suggest the following in the Pre Deploy hook of your stack. All based on @mbecker20's suggestion. Kudos! ``` git config submodule.<path-to-submodule>.url https://token:[[YOUR_SECRET]]@github.com/org/submodule-repo.git git submodule update --init --recursive ``` This will overwrite your submodule URL and allow you to use a secret that you have specified in the Komodo secret store.
Author
Owner

@Selovert commented on GitHub (Aug 4, 2025):

Thanks, all! Ended up with a slightly-tweaked version of what @mbecker20 and @Ga22be came up with.

I set up my repository as a Repo Resource in Komodo 1.18.4. Config below:

On Clone

git config submodule.<path-to-submodule>.url https://token:[[YOUR_SECRET]]@<git-repo-url>.git
git submodule sync
git submodule update --init --recursive

On Pull

git submodule update --init --recursive
@Selovert commented on GitHub (Aug 4, 2025): Thanks, all! Ended up with a slightly-tweaked version of what @mbecker20 and @Ga22be came up with. I set up my repository as a **Repo Resource** in Komodo **1.18.4**. Config below: ## On Clone ``` git config submodule.<path-to-submodule>.url https://token:[[YOUR_SECRET]]@<git-repo-url>.git git submodule sync git submodule update --init --recursive ``` ## On Pull ``` git submodule update --init --recursive ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#289
No description provided.