sources: make submodule fetching configurable
Metadata
Current evaluation
Merged. Adds source-submodules configuration to snapcraft.yaml, enabling users to specify which git submodules to fetch, skip all with an empty list, or omit to fetch all by default. Approved and merged following successful CI checks.
Suggested action: —
No scores available.
Issue body
- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [X] Have you successfully run `./runtests.sh static`?
- [X] Have you successfully run `./runtests.sh tests/unit`?
-----
Alternative solution from https://github.com/snapcore/snapcraft/pull/3623
https://bugs.launchpad.net/snapcraft/+bug/1957767
Configure which submodules to fetch from the source tree in snapcraft.yaml with `source-submodules: <list-of-submodules>`.
#### Defined
If `source-submodules` is defined, only the listed submodules are fetched.
```
parts:
git-test:
plugin: dump
source-type: git
source: git@github.com...
source-submodules:
- submodule_1
- dir1/submodule_2
```
#### Defined and Empty
If `source-submodules` in defined and empty, no submodules are fetched.
```
parts:
git-test:
plugin: dump
source-type: git
source: git@github.com...
source-submodules: []
```
#### Not Defined
If `source-submodules` is not defined, all submodules are fetched (default behavior).
#### Note
If a submodule is fetched, any submodules of that submodules are fetched too. I don't think the behavior needs to be any more nuanced (i.e. no need to define which submodules to fetch recursively and which to fetch non-recursively).
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged. Adds source-submodules configuration to snapcraft.yaml, enabling users to specify which git submodules to fetch, skip all with an empty list, or omit to fetch all by default. Approved and merged following successful CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main. Adds source-submodules configuration to snapcraft.yaml for controlling git submodule fetching. Specify a list to fetch only those, an empty list to skip fetching, or omit the key to fetch all submodules by default. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into main. Introduces source-submodules configuration to control git submodule fetching in snapcraft.yaml. Allows specifying submodules, fetching none, or keeping the default all-submodule behavior. Resolves bug #1957767 following test fixes. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #169 sources: make submodule fetching configurable | craft-parts | merged | Merged the changes to make submodule fetching configurable in craft-parts. The update was approved by one reviewer, passed CI checks, and adapts a feature previously implemented for snapcraft. | |
| #3635 sources: make submodule fetching configurable | snapcraft | merged | Merged into the snapcraft/7.0 branch as a backport of PR #3629. The update makes submodule fetching configurable, passed review and CI, and was integrated without impacting coverage. | |
| #1640675 Add source option for git submodules | snapcraft (launchpad) | open | Feature request to add a source-submodules option to the git source so only listed submodules are cloned instead of all recursively. The requested option was implemented in merged PR canonical/snapcraft#3629, so the issue is outdated and ready to close. |