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

Cannot build merge requests from Gitlab on a multibranch pipeline job after Git plugin update to version 3.5.0

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • git-plugin
    • Jenkins 2.60.1
      Git plugin 3.5.0
      GitLab 9.0

      Previous to the update of the git plugin everything was working fine (with Git plugin version 3.4.1).

      After updating to version 3.5.0 now I am not able to build neither merque-requests nor tags, I only see regular branches from the repository (GitLab by the way).

      I've been looking changes made in the code, more precisely changes made in

      src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java

      There has been a major change in the way branches are discovered (that can be seen in the function "discoverBranches"):

      • 3.4.1 - In this version, "client.getRemoteBranches" is used, which I guess, corresponds to a "git branch -r". Then it parses the output to get the names of the branches.
      • 3.5.0 - In this version, "client.getRemoteReferences" is used, that corresponds to a "git ls-remote -h". Then, it parses the output to get the names of the branches.

      I've set "Specify ref specs" with the needed values to be able to fetch  the merge-requests and the tags ('+refs/merge-requests//head:refs/remotes/origin/merge-requests/' and '+refs/tags/:refs/remotes/origin/tags/').

      If I perform manually both operations ("git branch -r" and "git ls-remote -h") the output is not the same:

      $ git branch -r
      origin/HEAD -> origin/master

      origin/feature/generic-tag-attribute
      origin/merge-requests/1
      origin/merge-requests/2
      origin/merge-requests/3
      origin/tags/v1.5.0-alpha.0

      and

      $ git ls-remote -h 
      From http:/**********
      2c26dca25a748017ff52b22d81c549506abc12be refs/heads/feature/generic-tag-attribute
      1f43ef826799500cb585273eca3517c8a5eb026a refs/heads/master

      In the first example (mimics Git plugin 3.4.1) I get merge-requests and tags, in the second (mimics 3.5.0) I don't.

          [JENKINS-45987] Cannot build merge requests from Gitlab on a multibranch pipeline job after Git plugin update to version 3.5.0

          Asier Marruedo created issue -
          Asier Marruedo made changes -
          Description Original: Previous to the update of the git plugin everything was working fine (with Git plugin version 3.4.1).

          After updating to version 3.5.0 now I am not able to build neither merque-requests nor tags, I only see regular branches from the repository (GitLab by the way).

          I've been looking changes made in the code, more precisely changes made in
          {quote}{{src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java}}
          {quote}
          There has been a major change in the way branches are discovered (that can be seen in the function "discoverBranches"):
           * 3.4.1 - In this version, "client.getRemoteBranches" is used, which I guess, corresponds to a "git branch -r". Then it parses the output to get the names of the branches.
           * 3.5.0 - In this version, "client.getRemoteReferences" is used, that corresponds to a "git ls-remote -h". Then, it parses the output to get the names of the branches.

          I've set "Specify ref specs" with the needed values to be able to fetch  the merge-requests and the tags (+refs/merge-requests/*/head:refs/remotes/origin/merge-requests/* and +refs/tags/*:refs/remotes/origin/tags/*).

          If I perform manually both operations ("git branch -r" and "git ls-remote -h") the output is not the same:
          {quote}$ git branch -r
           origin/HEAD -> origin/masterorigin/feature/generic-tag-attribute
          origin/master
           origin/merge-requests/1
           origin/merge-requests/2
           origin/merge-requests/3
          origin/tags/v1.5.0-alpha.0{quote}
          and
          {quote}$ git ls-remote -h 
          From http://gitlab.rnd.saltosystems.com/pro-access/salto.commons.git
          2c26dca25a748017ff52b22d81c549506abc12be refs/heads/feature/generic-tag-attribute
          1f43ef826799500cb585273eca3517c8a5eb026a refs/heads/master
          {quote}
          In the first example (mimics Git plugin 3.4.1) I get merge-requests and tags, in the second (mimics 3.5.0) I don't.
          New: Previous to the update of the git plugin everything was working fine (with Git plugin version 3.4.1).

          After updating to version 3.5.0 now I am not able to build neither merque-requests nor tags, I only see regular branches from the repository (GitLab by the way).

          I've been looking changes made in the code, more precisely changes made in
          {quote}{{src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java}}
          {quote}
          There has been a major change in the way branches are discovered (that can be seen in the function "discoverBranches"):
           * 3.4.1 - In this version, "client.getRemoteBranches" is used, which I guess, corresponds to a "git branch -r". Then it parses the output to get the names of the branches.
           * 3.5.0 - In this version, "client.getRemoteReferences" is used, that corresponds to a "git ls-remote -h". Then, it parses the output to get the names of the branches.

          I've set "Specify ref specs" with the needed values to be able to fetch  the merge-requests and the tags (+refs/merge-requests/*/head:refs/remotes/origin/merge-requests/* and +refs/tags/*:refs/remotes/origin/tags/*).

          If I perform manually both operations ("git branch -r" and "git ls-remote -h") the output is not the same:
          {quote}$ git branch -r
           origin/HEAD -> origin/master

          origin/feature/generic-tag-attribute
           origin/merge-requests/1
           origin/merge-requests/2
           origin/merge-requests/3
           origin/tags/v1.5.0-alpha.0
          {quote}
          and
          {quote}$ git ls-remote -h 
           From http:/**********
           2c26dca25a748017ff52b22d81c549506abc12be refs/heads/feature/generic-tag-attribute
           1f43ef826799500cb585273eca3517c8a5eb026a refs/heads/master
          {quote}
          In the first example (mimics Git plugin 3.4.1) I get merge-requests and tags, in the second (mimics 3.5.0) I don't.
          Asier Marruedo made changes -
          Description Original: Previous to the update of the git plugin everything was working fine (with Git plugin version 3.4.1).

          After updating to version 3.5.0 now I am not able to build neither merque-requests nor tags, I only see regular branches from the repository (GitLab by the way).

          I've been looking changes made in the code, more precisely changes made in
          {quote}{{src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java}}
          {quote}
          There has been a major change in the way branches are discovered (that can be seen in the function "discoverBranches"):
           * 3.4.1 - In this version, "client.getRemoteBranches" is used, which I guess, corresponds to a "git branch -r". Then it parses the output to get the names of the branches.
           * 3.5.0 - In this version, "client.getRemoteReferences" is used, that corresponds to a "git ls-remote -h". Then, it parses the output to get the names of the branches.

          I've set "Specify ref specs" with the needed values to be able to fetch  the merge-requests and the tags (+refs/merge-requests/*/head:refs/remotes/origin/merge-requests/* and +refs/tags/*:refs/remotes/origin/tags/*).

          If I perform manually both operations ("git branch -r" and "git ls-remote -h") the output is not the same:
          {quote}$ git branch -r
           origin/HEAD -> origin/master

          origin/feature/generic-tag-attribute
           origin/merge-requests/1
           origin/merge-requests/2
           origin/merge-requests/3
           origin/tags/v1.5.0-alpha.0
          {quote}
          and
          {quote}$ git ls-remote -h 
           From http:/**********
           2c26dca25a748017ff52b22d81c549506abc12be refs/heads/feature/generic-tag-attribute
           1f43ef826799500cb585273eca3517c8a5eb026a refs/heads/master
          {quote}
          In the first example (mimics Git plugin 3.4.1) I get merge-requests and tags, in the second (mimics 3.5.0) I don't.
          New: Previous to the update of the git plugin everything was working fine (with Git plugin version 3.4.1).

          After updating to version 3.5.0 now I am not able to build neither merque-requests nor tags, I only see regular branches from the repository (GitLab by the way).

          I've been looking changes made in the code, more precisely changes made in
          {quote}{{src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java}}
          {quote}
          There has been a major change in the way branches are discovered (that can be seen in the function "discoverBranches"):
           * 3.4.1 - In this version, "client.getRemoteBranches" is used, which I guess, corresponds to a "git branch -r". Then it parses the output to get the names of the branches.
           * 3.5.0 - In this version, "client.getRemoteReferences" is used, that corresponds to a "git ls-remote -h". Then, it parses the output to get the names of the branches.

          I've set "Specify ref specs" with the needed values to be able to fetch  the merge-requests and the tags ('+refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*' and '+refs/tags/*:refs/remotes/origin/tags/*').

          If I perform manually both operations ("git branch -r" and "git ls-remote -h") the output is not the same:
          {quote}$ git branch -r
           origin/HEAD -> origin/master

          origin/feature/generic-tag-attribute
           origin/merge-requests/1
           origin/merge-requests/2
           origin/merge-requests/3
           origin/tags/v1.5.0-alpha.0
          {quote}
          and
          {quote}$ git ls-remote -h 
           From http:/**********
           2c26dca25a748017ff52b22d81c549506abc12be refs/heads/feature/generic-tag-attribute
           1f43ef826799500cb585273eca3517c8a5eb026a refs/heads/master
          {quote}
          In the first example (mimics Git plugin 3.4.1) I get merge-requests and tags, in the second (mimics 3.5.0) I don't.
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Mark Waite made changes -
          Summary Original: Cannot build mergue requests from Gitlab on a multibranch pipeline job after Git plugin update to version 3.5.0 New: Cannot build merge requests from Gitlab on a multibranch pipeline job after Git plugin update to version 3.5.0

          Joe Julian added a comment -

          I, too, am having this problem with 3.5.0.

          Joe Julian added a comment - I, too, am having this problem with 3.5.0.

          Andreas Löhr added a comment - - edited

          ... exactly same issue here, but with 3.5.1

          Andreas Löhr added a comment - - edited ... exactly same issue here, but with 3.5.1

          Andreas Löhr added a comment -

          ... any plans/ideas to resolve this? I depend on it and have to think of a workaround otherwise

          Andreas Löhr added a comment - ... any plans/ideas to resolve this? I depend on it and have to think of a workaround otherwise
          Andreas Löhr made changes -
          Priority Original: Major [ 3 ] New: Blocker [ 1 ]
          Asier Marruedo made changes -

            amarruedo Asier Marruedo
            amarruedo Asier Marruedo
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: