I have a blue ocean project which grabs a git project using an ssh key, I added new shell commands but it doesn't pull the submodules in the .gitsubmodules folder:
[submodule "Assets/Engine"]
path = Assets/Engine
url = killerbros@vs-ssh.visualstudio.com:22/Game/_ssh/Engine
branch = "master"
[submodule "Assets/PlatformerModule/Extension"]
path = Assets/PlatformerModule/Extension
url = killerbros@vs-ssh.visualstudio.com:22/Game/_ssh/PlatformerModule
branch = "master"
I tried adding shell commands for git submodule init and git submodule update but it fails on gitsubmodule update due to authentication:
Cloning into '/Users/Shared/Jenkins/Home/workspace/Platform_master-6J2EI5MV24CJ5OZMBARB5I3D276FBUM4RTXAZNAML5SYUAR7S3YA/Assets/Le'... Permission denied, please try again. Permission denied, please try again. myapp@vs-ssh.visualstudio.com: Permission denied (password,publickey). fatal: Could not read from remote repository.
I also tried adding the 'advanced submodule step' in the git scm plugin to no avail.
Is there a way to make sure it uses the correct ssh key for those updates as well?
Is there a way to make sure it uses the correct ssh key for those updates as well?
Yes, using the JENKINS SSH Credentials Plugin, you can copy the private key in that plugin, and use the associated credential for the Git repo job setting, which will make any ssh call using said private key.
This supposes a recent enough (2016) version of the Jenkins Git client.
As seen here, you can use credentials from default remote of parent repository in the Advanced sub-modules behaviours settings.