For my Jenkins build, I need to manage a Github repository to automate building a project. However, the issue is that this repository needs to pull a submodule from Bitbucket. This requires two difference instances of authentication, one for each service. As of now, Jenkins is only allowing the use of a single set of credentials, using a username and SSH key. Is there a way to specify a different set of credentials for each pull?
2 Answers
It is a convenience that Jenkins will pull from git for you. With such a complex setup as needing to pull from two repos you can simply use a pipeline job that runs "sh" to explicitly git checkout the code and pull the submodules:
sh "git checkout ${custom_env_var} ${custom_parameter}
The good news with this slightly manual approach is that you can debug the sh commands to run on a dev server and cut paste them straight into a pipeline. Just start a “sh” session (usually it runs bash) and test the commands.
Assuming you are populating a tree of files to do a build, and some files come from Git and some from BitBucket, here are a few suggestions:
-Use two Jenkins jobs, one triggered by another
-Use a script run by a Jenkins job
-Add a pull to your make or other build toolchain to include the outside library