I have a repository that contains submodules. These are developed in a publicly accessible GitHub repository. My final deployment however is in a disconnected environment with mirrored GitHub repos in GitLab, which all require authentication.
My .gitmodules
file contains URLs for the publicly available repos. I did some sed
replacement in the job and can update them properly, but unfortunately, I'm then not able to authenticate, since it's a separate operation from the git url:....
step.
I can clone the project with:
git url: "git@my.gitlab.secure", branch: "master", credentialsId: "somecredentialid"
This doesn't update my submodules though unfortunately. And since I require authentication.
I also can clone using the checkout
:
checkout([
$class: 'GitSCM',
branches: [[name: 'master']],
doGenerateSubmoduleConfigurations: true,
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: true,
recursiveSubmodules: true,
reference: '', trackingSubmodules: true]],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: 'somecredentialid',
url: 'git@my.gitlab.secure']]
])
}
}
It isn't clear to me from the documentation what doGenerateSubmoduleConfigurations: true,
and submoduleCfg:
are for.
I feel like the checkout
way might be the solution, but I can't figure out how to update the .gitmodules
to reflect the secured URLs for the submodules.