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

Merge before build, reference is not a tree on second build

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • 2.176.2
      git-plugin 2.8.0

      Pipeline Jenkins build with

      SCM: GIT

      Branches to build: refs/tags/*_${RELEASE}_feature

      Additional Behaviours: Merge before build

       

      first polled build is ok (change is detected and merged), see log

      second build triggered by hand gets error (no change), see log

       

        1. config.xml
          3 kB
        2. first-good.txt
          11 kB
        3. Jenkinsfile
          0.2 kB
        4. second-bad.txt
          4 kB

          [JENKINS-59008] Merge before build, reference is not a tree on second build

          P K added a comment -

          i use Additional Behaviours: Merge before build !!

          Jenkinsfile just push on success

          P K added a comment - i use Additional Behaviours: Merge before build !! Jenkinsfile just push on success

          Mark Waite added a comment -

          My statement from earlier still applies. Merge with a target tag will not work. Merge with a target branch works in my tests, so long as I use the LocalBranch extension. Your config.xml does not use the LocalBranch extension. git merge needs a branch in the working repository. Without the LocalBranch extension, the git plugin performs a checkout of a detached HEAD with no branch defined.

          Mark Waite added a comment - My statement from earlier still applies. Merge with a target tag will not work. Merge with a target branch works in my tests, so long as I use the LocalBranch extension. Your config.xml does not use the LocalBranch extension. git merge needs a branch in the working repository. Without the LocalBranch extension, the git plugin performs a checkout of a detached HEAD with no branch defined.

          P K added a comment -

          "Branch to merge to" is always a branch in my case!

          I checked that "Branches to build" for tag and branch is the same

          P K added a comment - "Branch to merge to" is always a branch in my case! I checked that "Branches to build" for tag and branch is the same

          Mark Waite added a comment -

          But your job definition does not include the LocalBranch extension, at least not the job definition that is uploaded. Without the LocalBranch extension, the workspace which Jenkins creates for the job does not have a branch, it only has a detached HEAD commit. A detached HEAD commit is good enough for builds but is not good enough for a merge.

          Mark Waite added a comment - But your job definition does not include the LocalBranch extension, at least not the job definition that is uploaded. Without the LocalBranch extension, the workspace which Jenkins creates for the job does not have a branch, it only has a detached HEAD commit. A detached HEAD commit is good enough for builds but is not good enough for a merge.

          P K added a comment -

          do you mean to configure "Check out to specific local branch" before merge step?  - it did not help.... and merge to detached HEAD worked too, as you see in my log...

          P K added a comment - do you mean to configure "Check out to specific local branch" before merge step?  - it did not help.... and merge to detached HEAD worked too, as you see in my log...

          Mark Waite added a comment -

          Sorry, I don't know what's different between your failing cases and my working cases. I've completed my investigation and placed my results into publicly accessible locations. I'll rely on you to compare my working cases and your failing cases.

          Mark Waite added a comment - Sorry, I don't know what's different between your failing cases and my working cases. I've completed my investigation and placed my results into publicly accessible locations. I'll rely on you to compare my working cases and your failing cases. Jenkinsfile on first branch that confirms pre-build merge works with branch targets and confirms it does not work with tag targets Jenkinsfile on second branch that confirms pre-build merge works with branch targets and confirms it does not work with tag targets Docker image definition that uses the Jenkinsfile to run the job (and many others)

          P K added a comment -

          please add push at the end of your Jenkinsfile

          without push it works and has always somthing to merge!!!

          P K added a comment - please add push at the end of your Jenkinsfile without push it works and has always somthing to merge!!!

          P K added a comment -

          any progress on this?????

          P K added a comment - any progress on this?????

          Mark Waite added a comment -

          No progress and none planned.

          Mark Waite added a comment - No progress and none planned.

          P K added a comment -

          great! see my last comment and retest with push

          P K added a comment - great! see my last comment and retest with push

            Unassigned Unassigned
            petekol P K
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: