-
Improvement
-
Resolution: Not A Defect
-
Minor
Sometimes the same repository might have different remotes (for example on different hosting providers) and you might want to work with the branches from different remotes. Other parts of the plugin allow you to specify the remote, but at the moment it can't really be anything other than origin (in the common case), so it seems weird.
I propose to add an option to add additional remotes to the repo after it's been cloned.
It could be something as simple as "name: ..., url: ..., (credentials: ...)?".
One common task that needs this and might be simplified if this is introduced is some automatic mirroring/repo syncing, i.e. when you want to update some branch in one remote with the new commits from some other branch in another remote at some regular intervals (perhaps, performing additional tests each time).
Thanks for the report. Can you provide more details to explain why you think the plugin does not support multiple remotes?
Multiple remotes are supported by Freestyle jobs. Refer to my JENKINS-55536 Freestyle job definition for the confirmation that Freestyle jobs support multiple remotes. Multiple remotes are under the "Advanced" button on the git repository configuration for Freestyle jobs.
Multiple remotes are supported by Declarative Pipeline and Scripted Pipeline jobs. Refer to the Jenkinsfile in my JENKINS-55536 branch to see the confirmation job that I've added to show multiple remotes in a Pipeline job. Multiple remotes are under the "Advanced" button on the git repository configuration for Pipeline syntax.
Because use of multiple remotes is an advanced feature, it is not included in the multibranch Pipeline user interface for GitHub branch source, Bitbucket branch source, or Gitea. Each of those branch sources use a more sophisticated web API to detect changes. That web API improves performance dramatically and reduces the load on the Jenkins master and the git hosting server. Even in those cases, multiple remote repositories can be defined and used within the Jenkinsfile hosted in the branches of those repositories (as shown in the Jenkinsfile).