Problem is simple: the main git repository can be accessed by Jenkins with ssh://ci_ro@server (works well), but I have submodules whose URL is different: ssh://server (without defining some user, this is to allow developers to work with this repo and its submodules). I am definitely not allowed (and frankly don’t want to) commit CI – specific .gitmodule files (this would break developer repos), so don’t even mention it please. So Jenkins can pull the main repo but instantly fails with:
Caused by: hudson.plugins.git.GitException: Command "git submodule update --init --recursive" returned status code 1: Cloning into blah/blah...
Host key verification failed.
fatal: The remote end hung up unexpectedly
Clone of 'ssh://server:someport/blah/blah...' into submodule path 'blah/blah' failed
My question: is it possible to tell Jenkins to use ssh://ci_ro@server… URL prefix for submodules instead of the configured ones in .gitmodules? Or any other workarounds, plugins, or hacks available? I looked through the job options and didn’t find any useful option.
UPDATE
Thanks for all the help guys. The resolution was to allow the ‘jenkins’ system user to pull from the specific ssh server/port with git.
The resolution was to allow the system user running Jenkins to pull with SSH from the specified hosts/ports.