Submodules in blueocean?
Asked Answered
M

1

7

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 = [email protected]:22/Game/_ssh/Engine
    branch = "master"
[submodule "Assets/PlatformerModule/Extension"]
    path = Assets/PlatformerModule/Extension
    url = [email protected]: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. [email protected]: 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?

Masterly answered 7/2, 2018 at 15:1 Comment(0)
D
5

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.

Dockyard answered 10/2, 2018 at 11:39 Comment(3)
You shoudn't copy in the private key. I think using the SSH agent plugin is more feasible. jenkins.io/doc/pipeline/steps/ssh-agentPrecipitous
@HendrikMHalkow You would still need to copy the private key, though. And the Agent would only by useful if the private key is protected by a passphrase.Dockyard
@HendrikMHalkow That benig said, yes, in declarative pipeline, you have to use the ssh-agent step.Dockyard

© 2022 - 2024 — McMap. All rights reserved.