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

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • Pretested Integration Plugin 2.2.3
      Git Plugin 2.3.5
      Jenkins core 1.612

      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

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

              Created:
              Updated: