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

(Praqma case 13216) Manual build - the Git Plugin prefix with 'refs/remotes' if checking out a branch

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Pretested Integration Plugin 2.2.3
      Git Plugin 2.3.5
      Jenkins core 1.612
    • Similar Issues:

      Description

      Related to doing a 'Build Now' or building a job manually with a parameter corresponding to a branch to checkout, the Git Plugin behaves differently from when polling.

      The Git Plugin will as shown below checkout the branch specified by the job parameter but the branch "refs/remotes/origin/ready/mybranch" have the prefix the remote reference with "refs/remotes" (instead of nothing as in "origin/ready/mybranch") when using polling.

      {{Checking out Revision f13d828b6bf8833045634b237c2b033180bd8bed (refs/remotes/origin/ready/mybranch)
      00:00:38.542 > git config core.sparsecheckout # timeout=10
      00:00:38.653 > git checkout -f f13d828b6bf8833045634b237c2b033180bd8bed
      00:01:13.004 First time build. Skipping changelog.
      00:01:13.005 No emails were triggered.
      00:01:13.050 [PREINT] Preparing environment using Pretested Integration Plugin 2.2.3 (5f8d7)
      00:01:13.050 Nothing to do the reason is: No revision matches configuration in 'Integration repository'
      00:01:13.050 f13d828b6bf8833045634b237c2b033180bd8bed
      00:01:13.050 refs/remotes/origin/ready/mybranch}}

      The problem occurs in the our code around the following lines, where we check the branch .startsWith "prefix".

      GitBridge.java:

      {{// An example on several BuilData - visualized can be found in 'docs/More_than_1_gitBuild_data.png'
      for(BuildData bdata : data) {
      // Assume no trailing slash in configuration - we won't match then.
      if(bdata.lastBuild.revision.getBranches().iterator().next().getName().startsWith(resolveRepoName()+"/")) {
      // No we now the git build data contain a branch that matches the integration repository name.
      // Eg. Branch 'origin/ready/feature_1' matches 'origin' configured as integration repository}}

      We should investigate it further, before actually changing our code

      • make a test to reproduce it
      • why does the Git Plugin bahave differently in the two work flows

        Attachments

          Activity

          Hide
          bue Bue Petersen added a comment -

          Just another observation...

          • if the branch name is ready/mybranch and thus contain "/" it will be prefixed. eg. refs/remote/origin/ready/mybranch
          • if there is no slash, like mybranch, there will be no prefix (origin/mybranch)
          Show
          bue Bue Petersen added a comment - Just another observation... if the branch name is ready/mybranch and thus contain "/" it will be prefixed. eg. refs/remote/origin/ready/mybranch if there is no slash, like mybranch, there will be no prefix (origin/mybranch)

            People

            • Assignee:
              praqma Praqma Support
              Reporter:
              bue Bue Petersen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: