My use case is that I would like to keep a list of submodules in .gitmodule
. However, I will need each submodule separately while building my package. example let say below is the content of my .gitmodule
file.
[submodule "submodule1"]
path = aiml/core/model/modelcollection
url = ssh://git@git.myorg.com/project/repo.git
branch = module1
[submodule "submodule2"]
path = aiml/core/model/modelcollection
url = ssh://git@git.myorg.com/project/repo.git
branch = module2
I am using the Jenkins checkout function as below.
checkout([
$class: 'GitSCM',
branches: [[name: 'develop']],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: true,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false]
],
submoduleCfg: [],
userRemoteConfigs: [[url: "git@git.myorg.com/project/repo.git"]]
])
In the above Jenkins checkout
function I could not find any option to restrict my submodule checkout to a specific submodule.
ex:- I want to checkout only the submodule1
but not the submodule2
.
Is there any way to achieve this? I am open to solutions either from the git side or from the Jenkins pipeline side. or Is there any better way to handle situations like this?