-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins 2.7.1
When a build has commits from multiple repositories (such as when using 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. If there are multiple repositories in play it becomes impossible to know the repository a commit came from.
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.getChangeSets() for Jenkinsfiles and AbstractBuild.getChangeSet() for Freestyle jobs). This would allow a consumer of the API to know which SCMs a commit came from.
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
"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" } ],
[JENKINS-52747] Jenkins REST API - Cannot determine source SCM when using multiple scms in Pipeline
Summary | Original: SCM API cannot determine remove URL | New: SCM API multi-scm cannot determine remote URL of a commit |
Issue Type | Original: New Feature [ 2 ] | New: Improvement [ 4 ] |
Description |
Original:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what remote URL a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the remoteUrl would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. 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. {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} |
New:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the remoteUrl would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. 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. {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} |
Description |
Original:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the remoteUrl would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. 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. {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} |
New:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository *remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. 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. {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} |
Description |
Original:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository *remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. 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. {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} |
New:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository (remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. 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. {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} |
Description |
Original:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository (remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. 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. {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} |
New:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository (remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. Despite this being a problem that surfaces from the multi-scm plugin I believe the change needs to be made in core. 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. {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} |
Assignee | Original: Mark Waite [ markewaite ] |
Attachment | New: workflowjob_multiscm.json [ 43505 ] |
Description |
Original:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository (remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. Despite this being a problem that surfaces from the multi-scm plugin I believe the change needs to be made in core. 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. {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} |
New:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository (remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. Despite this being a problem that surfaces from the multi-scm plugin I believe the change needs to be made in core. 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. {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} See attached file for full details. |
Description |
Original:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Jenkinsfile) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository (remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. Despite this being a problem that surfaces from the multi-scm plugin I believe the change needs to be made in core. 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. {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} See attached file for full details. |
New:
When a build has commits from multiple repositories using the multi-scm plugin it isn't possible to determine what repository (remote URL) a commit came from. It seems changeset(s) (s when Workflow) includes a list of ChangeSetList (GitChangeSetList for git) that correspond to the logs parsed from changelogN.xml. I believe knowledge of the repository (remoteUrl) would either have to be added to [ChangeLogSet.Entry|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java#L140] or [ChangeLogSet|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/scm/ChangeLogSet.java] if ChangeLogSet represents entities from the same remote. Despite this being a problem that surfaces from the multi-scm plugin I believe the change needs to be made in core. 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. {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} See attached file for full details. |