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

GitSCM rebuilds all the time while using poll scm

    Details

    • Similar Issues:

      Description

      Reproduction scenrario:
      create 2 remote branches in "origin"
      1) 1 - called bug/namespace/master
      2) 2 - called namespace/master

      Setup the projec to poll scm (every minute) and to build the branch namespace/master.
      Expected result: if there are no changes in namespace/master it wont get rebuilt.
      Actual: branch is constantly rebuilt

      the problem is in git-client since the command
      git ls-remote <uri> namespace/master will return you both branch revisions and take the first one ..
      buggy method is :

      CliGitAPIImpl:

      public ObjectId getHeadRev(String url, String branchSpec) throws GitException, InterruptedException

      { final String branchName = extractBranchNameFromBranchSpec(branchSpec); ArgumentListBuilder args = new ArgumentListBuilder("ls-remote"); args.add("-h"); StandardCredentials cred = credentials.get(url); if (cred == null) cred = defaultCredentials; args.add(url); args.add(branchName); String result = launchCommandWithCredentials(args, null, cred, url); return result.length()>=40 ? ObjectId.fromString(result.substring(0, 40)) : null; }

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          That is an unfortunate side effect of the design decision made long ago to split on the slash in the "branch to build". I'm not willing to break compatibility with that old design decision because of the number of users of the git plugin (and the git client plugin) and the many ways in which they depend on those plugins.

          Rather than break compatibility, Alexander Link has proposed that we accept "refs/heads/namespace/master" as an intentional declaration of the specific branch, without changing the semantics of other forms (like origin/master, */master).

          Would you be willing to assist with the evaluation of Alexander's proposed changes? They are included in https://github.com/jenkinsci/git-client-plugin/pull/135

          Show
          markewaite Mark Waite added a comment - That is an unfortunate side effect of the design decision made long ago to split on the slash in the "branch to build". I'm not willing to break compatibility with that old design decision because of the number of users of the git plugin (and the git client plugin) and the many ways in which they depend on those plugins. Rather than break compatibility, Alexander Link has proposed that we accept "refs/heads/namespace/master" as an intentional declaration of the specific branch, without changing the semantics of other forms (like origin/master, */master). Would you be willing to assist with the evaluation of Alexander's proposed changes? They are included in https://github.com/jenkinsci/git-client-plugin/pull/135
          Hide
          markewaite Mark Waite added a comment - - edited

          Refer to JENKINS-23884 for a description of the change that will be included in git-client-plugin which will allow you to more precisely specify the branch to build.

          Show
          markewaite Mark Waite added a comment - - edited Refer to JENKINS-23884 for a description of the change that will be included in git-client-plugin which will allow you to more precisely specify the branch to build.
          Hide
          markewaite Mark Waite added a comment -

          Fixed in git-client-plugin 1.10.0

          Show
          markewaite Mark Waite added a comment - Fixed in git-client-plugin 1.10.0

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              sashas83 sashas83
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: