Can somebody clarify how SubModule works in azure devops
MyDevOps Root Folder
I have a Solution called MyCore.sln containing 4-5 projects
I have my Main Solution called MyMain.sln containing another 4-5 projects project referencing MyCore.sln projects
It all compiles and works locally but fails when building in azure devops
Gone into MyMain.sln folder in powershell and executed as follows
executed as follows git submodule add https://[email protected]/MyGroup/MyProjec/_git/MyCore
I can see .gitmodules file
However when I go and build the pipeline it cannot find the projects that are referenced (belonging to myCore repo)
Am I missing the obvious?
Are there any comprehensive instructions on how to setup submodules in azure devops?
Can I visualize this anywhere?
In most cases, Git submodules are used when your project becomes more complex, and while your project depends on the main Git repository, you might want to keep their change history separate. Using the above as an example, the Room repository depends on the House repository, but they operate separately.
Submodules are very static and only track specific commits. Submodules do not track git refs or branches and are not automatically updated when the host repository is updated. When adding a submodule to a repository a new . gitmodules file will be created.
Specify multiple repositoriesRepositories can be specified as a repository resource, or inline with the checkout step. The following repository types are supported. Only Azure Repos Git ( git ) repositories in the same organization as the pipeline are supported for multi-repo checkout in Azure DevOps Server 2020.
Cloning a Project with Submodules If you pass --recurse-submodules to the git clone command, it will automatically initialize and update each submodule in the repository, including nested submodules if any of the submodules in the repository have submodules themselves.
In the advanced section of the Get Sources step you need to enable the Checkout Submodules option.
If you're using YAML builds, you need to add:
steps:
- checkout: self
submodules: true
As to your follow-up questions:
Ideally, you'd have a single solution, since you expect these projects to build together. Having multiple solutions will be awkward. If you want to share the components from one solution, you are probably better off publishing the projects from your 2nd repo as NuGet packages.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With