When a build has commits from multiple repositories (such as when using the multi-scm plugin or a pipeline job) it isn't possible to determine what repository (remote URL) a commit came from using the REST API.
The issue is neither a ChangeLogSet or a ChangeLogSet.Entry has any knowledge of the SCM it came from. Thus when the bean is exported the API does not have that information.
I believe the solution would be to add knowledge of the SCM (or even just remote URL) to the ChangeLogSet when the list of changeset(s) is built ([WorkflowRun|https://github.com/jenkinsci/workflow-job-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java#L971] for Jenkinsfiles and [AbstractBuild.getChangeSet()|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AbstractBuild.java#L817] for Freestyle jobs). This would cause the source SCM information to be exposed in the API.
For example, given a Jenkinsfile job with 4 git repos that only had commit changes for 2 of them the API response might look like the json below. Observe that it there is no way to know which remote a changeset came from. See the attached file for more details.
http://myjenkins:8080/view/folder/job/foo/job/master/17/api/json?pretty=true
{code:json} "changeSets" : [ { "_class" : "hudson.plugins.git.GitChangeSetList", "items" : [ { "_class" : "hudson.plugins.git.GitChangeSet", "affectedPaths" : [ ... ], "commitId" : "4da434ef7fccefa9a0922ee49556319efc923973", ... }, { "_class" : "hudson.plugins.git.GitChangeSet", "affectedPaths" : [ ... ], "commitId" : "b23c08d558786dd73ef5ba20737c485a6406a9f4", ... } ], "kind" : "git" }, { "_class" : "hudson.plugins.git.GitChangeSetList", "items" : [ { "_class" : "hudson.plugins.git.GitChangeSet", "affectedPaths" : [ ... ], "commitId" : "86593c915bf11f17d477072895a5afd2e5cb733f", ... } ], "kind" : "git" } ], {code} |
|
|