Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38800

remoteUrls are unordered in build data JSON when multiple git repositories are configured

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: git-plugin
    • Environment:
    • Similar Issues:

      Description

      When multiple Git repositories are added to the git plugin (not Multiple SCM plugin), the remoteUrls in the build data JSON are unordered (different from the order in which they were configured in the Jenkins job). This is because the remoteUrls are stored in a HashSet in BuildData.java. We can instead store them in a LinkedHashSet and preserve the order.

      This is needed so that we can associate the branch built, origin[x] (where x is the repository index) in lastBuiltRevision with the appropriate repository URL for which there is no provision right now when there are multiple repositories.

      {
      "buildsByBranchName" : {
      "origin/master" : {
      "buildNumber" : 1813,
      "buildResult" : null,
      "revision" : {
      "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
      "branch" : [

      { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin/master" }

      ]
      }
      },
      "origin/mri" : {
      "buildNumber" : 50,
      "buildResult" : null,
      "revision" : {
      "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513",
      "branch" : [

      { "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513", "name" : "origin/mri" }

      ]
      }
      }
      },
      "lastBuiltRevision" : {
      "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
      "branch" : [

      { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin1/master" }

      ],
      "remoteUrls" : [
      "https://github.com/repo1.git",
      "https://github.com/repo2.git",
      ]
      }

        Attachments

          Activity

          pxk5958 Pratith Kanagaraj created issue -
          pxk5958 Pratith Kanagaraj made changes -
          Field Original Value New Value
          Description When multiple Git repositories are added to the git plugin (not Multiple SCM plugin), the remoteUrls in the build data JSON are unordered (different from the order in which they were configured in the Jenkins job). This is because the remoteUrls are stored in a HashSet in BuildData.java. We can instead store them in a LinkedHashSet and preserve the order.

          This is needed so that we can associate the branch built, origin[x] (where x is the repository index) in lastBuiltRevision with the appropriate repository URL for which there is no provision right now when there are multiple repositories.

          {
          "buildsByBranchName" : {
          "origin/master" : {
          "buildNumber" : 1813,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin/master" }
          ]
          }
          },
          "origin/mri" : {
          "buildNumber" : 50,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513",
          "branch" : [
          { "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513", "name" : "origin/mri" }
          ]
          }
          }
          },
          "lastBuiltRevision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin1/master" }
          ],
          "remoteUrls" : [
          "https://github.com/repo1.git",
          "https://github.com/repo2.git",
          ]
          },
          When multiple Git repositories are added to the git plugin (not Multiple SCM plugin), the remoteUrls in the build data JSON are unordered (different from the order in which they were configured in the Jenkins job). This is because the remoteUrls are stored in a HashSet in BuildData.java. We can instead store them in a LinkedHashSet and preserve the order.

          This is needed so that we can associate the branch built, origin[x] (where x is the repository index) in lastBuiltRevision with the appropriate repository URL for which there is no provision right now when there are multiple repositories.

          {quote}{
          "buildsByBranchName" : {
          "origin/master" : {
          "buildNumber" : 1813,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin/master" }
          ]
          }
          },
          "origin/mri" : {
          "buildNumber" : 50,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513",
          "branch" : [
          { "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513", "name" : "origin/mri" }
          ]
          }
          }
          },
          "lastBuiltRevision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin1/master" }
          ],
          "remoteUrls" : [
          "https://github.com/repo1.git",
          "https://github.com/repo2.git",
          ]
          },{quote}
          pxk5958 Pratith Kanagaraj made changes -
          Description When multiple Git repositories are added to the git plugin (not Multiple SCM plugin), the remoteUrls in the build data JSON are unordered (different from the order in which they were configured in the Jenkins job). This is because the remoteUrls are stored in a HashSet in BuildData.java. We can instead store them in a LinkedHashSet and preserve the order.

          This is needed so that we can associate the branch built, origin[x] (where x is the repository index) in lastBuiltRevision with the appropriate repository URL for which there is no provision right now when there are multiple repositories.

          {quote}{
          "buildsByBranchName" : {
          "origin/master" : {
          "buildNumber" : 1813,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin/master" }
          ]
          }
          },
          "origin/mri" : {
          "buildNumber" : 50,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513",
          "branch" : [
          { "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513", "name" : "origin/mri" }
          ]
          }
          }
          },
          "lastBuiltRevision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin1/master" }
          ],
          "remoteUrls" : [
          "https://github.com/repo1.git",
          "https://github.com/repo2.git",
          ]
          },{quote}
          When multiple Git repositories are added to the git plugin (not Multiple SCM plugin), the remoteUrls in the build data JSON are unordered (different from the order in which they were configured in the Jenkins job). This is because the remoteUrls are stored in a HashSet in BuildData.java. We can instead store them in a LinkedHashSet and preserve the order.

          This is needed so that we can associate the branch built, origin[x] (where x is the repository index) in lastBuiltRevision with the appropriate repository URL for which there is no provision right now when there are multiple repositories.

          {
          "buildsByBranchName" : {
          "origin/master" : {
          "buildNumber" : 1813,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin/master" }
          ]
          }
          },
          "origin/mri" : {
          "buildNumber" : 50,
          "buildResult" : null,
          "revision" : {
          "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513",
          "branch" : [
          { "SHA1" : "f68f612f42908af792e831613deb4b6fe43ff513", "name" : "origin/mri" }
          ]
          }
          }
          },
          "lastBuiltRevision" : {
          "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6",
          "branch" : [
          { "SHA1" : "a0b422c02d45c71ca6e5317eb3aa6026d0f4ada6", "name" : "origin1/master" }
          ],
          "remoteUrls" : [
          "https://github.com/repo1.git",
          "https://github.com/repo2.git",
          ]
          }
          markewaite Mark Waite made changes -
          Assignee Mark Waite [ markewaite ]

            People

            • Assignee:
              Unassigned
              Reporter:
              pxk5958 Pratith Kanagaraj
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: