[JIRA] (JENKINS-59008) Merge before build, reference is not a tree on second build if merge target is a tag

19 views
Skip to first unread message

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 23, 2019, 8:21:02 AM8/23/19
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Jenkins / Bug JENKINS-59008
Merge before build, reference is not a tree on second build if merge target is a tag
Change By: Mark Waite
Summary: Merge before build, reference is not a tree on second build if merge target is a tag
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 23, 2019, 8:27:02 AM8/23/19
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-59008
 
Re: Merge before build, reference is not a tree on second build if merge target is a tag

Thanks. A tag as a merge target will not work. I've confirmed that a branch merge target works as expected while a tag merge target fails consistently, whether in a multibranch Pipeline or a Pipeline job based on a single branch of a repository.

I assume the first success case in your job may be a happy accident.

If merge to a tag is critical, you can likely perform the merge step you want using sh or bat or powershell calls to command line git to perform the merge. Merge is a local operation in git (unless you're using large files) and should not require any credentials.

Refer to my JENKINS-59008 check job to see the techniques I explored while trying to merge to a tag.

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 23, 2019, 8:38:02 AM8/23/19
to jenkinsc...@googlegroups.com

petekol@mail.ru (JIRA)

unread,
Aug 23, 2019, 8:46:02 AM8/23/19
to jenkinsc...@googlegroups.com
P K commented on Bug JENKINS-59008
 
Re: Merge before build, reference is not a tree on second build if merge target is a tag

i checked with a branch and it did not work either (do not forget that second build is triggered by hand and there is no change in git). I had to press "add Branch" in "Branches to build" because just changing field content had no effect.

 

petekol@mail.ru (JIRA)

unread,
Aug 23, 2019, 8:47:02 AM8/23/19
to jenkinsc...@googlegroups.com
P K edited a comment on Bug JENKINS-59008
i checked with a branch and it did not work either (do not forget that second build is triggered by hand and there is no change in git). I had to press "add Branch" in "Branches to build" because just changing field content had no effect on poller .

 

petekol@mail.ru (JIRA)

unread,
Aug 23, 2019, 8:48:02 AM8/23/19
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 23, 2019, 8:55:02 AM8/23/19
to jenkinsc...@googlegroups.com
Mark Waite commented on Bug JENKINS-59008
 
Re: Merge before build, reference is not a tree on second build if merge target is a tag

I trigger second (and subsequent) builds by hand (interactive click of 'Build now') and merges with a branch target work as expected in all the cases I have (except the JGit case where a null pointer exception blocks the merge).

In my success case, I am using the LocalBranch extension to assure that the repository in the workspace includes a branch.

The Jenkinsfile you attached does not perform a merge. Maybe you used a different Jenkinsfile?

petekol@mail.ru (JIRA)

unread,
Aug 23, 2019, 9:00:03 AM8/23/19
to jenkinsc...@googlegroups.com
P K commented on Bug JENKINS-59008

i use Additional Behaviours: Merge before build !!

Jenkinsfile just push on success

mark.earl.waite@gmail.com (JIRA)

unread,
Aug 23, 2019, 9:05:02 AM8/23/19
to jenkinsc...@googlegroups.com

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.

petekol@mail.ru (JIRA)

unread,
Aug 23, 2019, 9:11:04 AM8/23/19
to jenkinsc...@googlegroups.com
P K commented on Bug JENKINS-59008

"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.earl.waite@gmail.com (JIRA)

unread,
Aug 23, 2019, 9:22:02 AM8/23/19
to jenkinsc...@googlegroups.com

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.

petekol@mail.ru (JIRA)

unread,
Aug 23, 2019, 9:46:02 AM8/23/19
to jenkinsc...@googlegroups.com
P K commented on Bug JENKINS-59008

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...

Reply all
Reply to author
Forward
0 new messages