[JIRA] (JENKINS-61850) TFS pull request verification build uses wrong branch

19 views
Skip to first unread message

gan.ainm@gmx.com (JIRA)

unread,
Apr 9, 2020, 8:41:05 AM4/9/20
to jenkinsc...@googlegroups.com
Gan Ainm created an issue
 
Jenkins / Bug JENKINS-61850
TFS pull request verification build uses wrong branch
Issue Type: Bug Bug
Assignee: redsolo
Components: tfs-plugin
Created: 2020-04-09 12:40
Environment: Jenkins 2.222.1, TFS plugin 5.157.1
Priority: Minor Minor
Reporter: Gan Ainm

I configured a Jenkins job for TFS PR verification builds as described in the Git section of https://github.com/jenkinsci/tfs-plugin. The pull request commints are found on  branches named remotes/origin/pull/n/merge, so I added an additional branch specifier {{/merge }}to the *Branches to build section of my Jenkins job definition.

However, when the build runs, Git refuses to accept the commit from the merge }}branch with the error message skipping resolution of commit ..., since it originates from another repository but builds with the {{HEAD commit of the master branch.

Here is an excerpt of git log --oneline --graph --decorate --all:

* 7fcad29 (origin-pull/3/merge) Merge pull request 3 from feature-one into master
{{|\ }}
| * 37f0c7d (origin/feature-one) Test
* | c7e2002 (HEAD, origin/master) Merged PR 2: change 5

Here is the console log:

Lightweight checkout support not available, falling back to full checkout.
Checking out git http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git into /var/jenkins_home/workspace/pull-request-verification@script to read Jenkinsfile
using credential c0c927b7-0a3a-4051-af13-91ef394cd497
{{ > git rev-parse --is-inside-work-tree # timeout=10}}
Fetching changes from the remote Git repository
{{ > git config remote.origin.url http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git # timeout=10}}
Fetching upstream changes from http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git
{{ > git --version # timeout=10}}
{{using GIT_ASKPASS to set credentials }}
{{ > git fetch --tags --progress – http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git +refs/heads/:refs/remotes/origin/ +refs/pull/:refs/remotes/origin-pull/ # timeout=10}}
skipping resolution of commit 7fcad293a558164c074986e0746a79eee02ba79d, since it originates from another repository
Seen branch in repository origin-pull/2/merge
Seen branch in repository origin-pull/3/merge
Seen branch in repository origin/feature-one
Seen branch in repository origin/master
Seen 4 remote branches
{{ > git show-ref --tags -d # timeout=10}}
Checking out Revision c7e2002a890151347a6bf38c5fbd423756149d1a (origin/master)
{{ > git config core.sparsecheckout # timeout=10}}
{{ > git checkout -f c7e2002a890151347a6bf38c5fbd423756149d1a # timeout=10}}
Commit message: "Merged PR 2: change 5"
{{ > git rev-list --no-walk c7e2002a890151347a6bf38c5fbd423756149d1a # timeout=10}}
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/pull-request-verification
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
using credential c0c927b7-0a3a-4051-af13-91ef394cd497
{{ > git rev-parse --is-inside-work-tree # timeout=10}}
Fetching changes from the remote Git repository
{{ > git config remote.origin.url http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git # timeout=10}}
Fetching upstream changes from http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git
{{ > git --version # timeout=10}}
{{using GIT_ASKPASS to set credentials }}
{{ > git fetch --tags --progress – http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git +refs/heads/:refs/remotes/origin/ +refs/pull/:refs/remotes/origin-pull/ # timeout=10}}
skipping resolution of commit 7fcad293a558164c074986e0746a79eee02ba79d, since it originates from another repository
Seen branch in repository origin-pull/2/merge
Seen branch in repository origin-pull/3/merge
Seen branch in repository origin/feature-one
Seen branch in repository origin/master
Seen 4 remote branches
{{ > git show-ref --tags -d # timeout=10}}
Checking out Revision c7e2002a890151347a6bf38c5fbd423756149d1a (origin/master)
{{ > git config core.sparsecheckout # timeout=10}}
{{ > git checkout -f c7e2002a890151347a6bf38c5fbd423756149d1a # timeout=10}}
Commit message: "Merged PR 2: change 5"
{{[Pipeline] }}}
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] sh
+ cat README.md
# Test Repository

This repository has been set up for testing purposes only.

This is another line added to trigger a build.
And one more.

This change has also been done on the feature-one branch.
(First line removed)

2020-04-08T13:23:58+00:00
2020-04-08T13:27:16+00:00
{{[Pipeline] }}}
[Pipeline] // stage
{{[Pipeline] }}}
[Pipeline] // withEnv
{{[Pipeline] }}}
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

gan.ainm@gmx.com (JIRA)

unread,
Apr 9, 2020, 8:45:03 AM4/9/20
to jenkinsc...@googlegroups.com
Gan Ainm updated an issue
Change By: Gan Ainm
I configured a Jenkins job for TFS PR verification builds as described in the Git section of [https://github.com/jenkinsci/tfs-plugin.] The pull request commints are found on  branches named {{remotes/origin/pull/n/merge}}, so I added an additional branch specifier {{ " */merge }} " to the *Branches to build* section of my Jenkins job definition.

However, when the build runs, Git refuses to accept the commit from the
" {{merge }} " branch with the error message {{ _skipping resolution of commit ..., since it originates from another repository_ }} but builds with the {{HEAD}} commit of the {{master}} branch.

Here is an excerpt of *git log --oneline --graph --decorate --all*:

{{* 7fcad29 (origin-pull/3/merge) Merge pull request 3 from feature-one into master}}
\ {{|\ }}
{{| * 37f0c7d (origin/feature-one) Test}}
{{* | c7e2002 (HEAD, origin/master) Merged PR 2: change 5}}

Here is the console log:

{{Lightweight checkout support not available, falling back to full checkout.}}
{{Checking out git
[ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] into /var/jenkins_home/workspace/pull-request-verification@script to read Jenkinsfile}}
{{using credential c0c927b7-0a3a-4051-af13-91ef394cd497}}
\ {{ > git rev-parse --is-inside-work-tree # timeout=10}}
{{Fetching changes from the remote Git repository}}
{{ > git config remote.origin.url
[ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] # timeout=10}}
{{Fetching upstream changes from
[ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] }}
\ {{ > git --version # timeout=10}}
\
{{using GIT_ASKPASS to set credentials }}
{{ > git fetch --tags --progress
-- – [ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin-pull/* # timeout=10}}
{{using GIT_ASKPASS to set credentials }}
{{ > git fetch --tags --progress
-- – [ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin-pull/* # timeout=10}}

gan.ainm@gmx.com (JIRA)

unread,
Apr 9, 2020, 8:47:03 AM4/9/20
to jenkinsc...@googlegroups.com
Gan Ainm updated an issue
I configured a Jenkins job for TFS PR verification builds as described in the Git section of [https://github.com/jenkinsci/tfs-plugin.] The pull request commints are found on  branches named {{remotes/origin/pull/n/merge}}, so I added an additional branch specifier "*/merge" to the *Branches to build* section of my Jenkins job definition.

However, when the build runs, Git refuses to accept the commit from the "{{merge}}" branch with the error message
{{ _skipping resolution of commit ..., since it originates from another repository_ }}
but builds with the {{HEAD}} commit of the {{master}} branch.


Here is an excerpt of *git log --oneline --graph --decorate --all*:

{{* 7fcad29 (origin-pull/3/merge) Merge pull request 3 from feature-one into master}}
\{{|\ }}
{{| * 37f0c7d (origin/feature-one) Test}}
{{* | c7e2002 (HEAD, origin/master) Merged PR 2: change 5}}

Here is the console log:

{{Lightweight checkout support not available, falling back to full checkout.}}
{{Checking out git [http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git] into /var/jenkins_home/workspace/pull-request-verification@script to read Jenkinsfile}}
{{using credential c0c927b7-0a3a-4051-af13-91ef394cd497}}
\{{ > git rev-parse --is-inside-work-tree # timeout=10}}
{{Fetching changes from the remote Git repository}}
{{ > git config remote.origin.url [http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git] # timeout=10}}
{{Fetching upstream changes from [http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git]}}
\{{ > git --version # timeout=10}}
\{{using GIT_ASKPASS to set credentials }}
{{ > git fetch --tags --progress – [http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git] +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin-pull/* # timeout=10}}
{{ > git fetch --tags --progress – [http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git] +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin-pull/* # timeout=10}}

gan.ainm@gmx.com (JIRA)

unread,
Apr 9, 2020, 8:57:03 AM4/9/20
to jenkinsc...@googlegroups.com
Gan Ainm updated an issue
I configured a Jenkins job for TFS PR verification builds as described in the Git section of [https://github.com/jenkinsci/tfs-plugin.] The pull request commints commits are found on  branches named {{remotes/origin/pull/n/merge}}, so I added an additional branch specifier " {{\ */merge " }} to the *Branches to build* section of my Jenkins job definition.


However, when the build runs, Git refuses to accept the commit from the
" {{merge}} " branch with the error message _skipping resolution of commit ..., since it originates from another repository_ but builds with the {{HEAD}} commit of the {{master}} branch.


Here is an excerpt of *git log --oneline --graph --decorate --all*:

{ { noformat}
* 7fcad29 (origin-pull/3/merge) Merge pull request 3 from feature-one into master }}
\{{ |\ }}
{{
  
| * 37f0c7d (origin/feature-one) Test }}
{{ * | c7e2002 (HEAD, origin/master) Merged PR 2: change 5

{noformat
} }

Here is the console log:

{ { noformat}
Lightweight checkout support not available, falling back to full checkout. }}
{{ Checking out git [ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] into /var/jenkins_home/workspace/pull-request-verification@script to read Jenkinsfile }}
{{ using credential c0c927b7-0a3a-4051-af13-91ef394cd497 }}
\{{ > git rev-parse --is-inside-work-tree # timeout=10 }}
{{ Fetching changes from the remote Git repository }}
{{ > git config remote.origin.url [ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] # timeout=10 }}
{{ Fetching upstream changes from [ http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ]}}
\{{ > git --version # timeout=10 }}
\{{ using GIT_ASKPASS to set credentials }}
{{

> git fetch --tags --progress – [ -- http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin-pull/* # timeout=10 }}
> git fetch --tags --progress – [ -- http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git ] +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin-pull/* # timeout=10 }}

{noformat
} }

gan.ainm@gmx.com (JIRA)

unread,
Apr 9, 2020, 8:59:02 AM4/9/20
to jenkinsc...@googlegroups.com
Gan Ainm updated an issue
I configured a Jenkins job for TFS PR verification builds as described in the Git section of [https://github.com/jenkinsci/tfs-plugin.] The pull request commits are found on  branches named {{remotes/origin/pull/n/merge}}, so I added an additional branch specifier {{\*/merge}} to the *Branches to build* section of my Jenkins job definition.

gan.ainm@gmx.com (JIRA)

unread,
Apr 9, 2020, 9:00:02 AM4/9/20
to jenkinsc...@googlegroups.com
Gan Ainm updated an issue
I configured a Jenkins job for TFS PR verification builds as described in the Git section of [https://github.com/jenkinsci/tfs-plugin.] The pull request commits are found on  branches named {{remotes/origin/pull/n/merge}}, so I added an additional branch specifier {{\*/merge}} to the *Branches to build* section of my Jenkins job definition.

However, when the build runs, Git refuses to accept the commit from the {{merge}} branch with the error message _skipping resolution of commit ..., since it originates from another repository_ but builds with the {{HEAD}} commit of the {{master}} branch instead of {{origin-pull/3/merge}} .

gan.ainm@gmx.com (JIRA)

unread,
Apr 15, 2020, 9:24:03 AM4/15/20
to jenkinsc...@googlegroups.com
Gan Ainm commented on Bug JENKINS-61850
 
Re: TFS pull request verification build uses wrong branch

Strangely, the build succeeds when the commit to be merged has been committed in the TFS git repository itself. When the change is pushed into the TFS git repository from a clone using a different user name and e-mail address, the pull request verification build fails as described above. Once user.name and user.email on the clone are set to be identical to the TFS git repo, the pull request verification build after the push succeeds. This seems really strange!

gan.ainm@gmx.com (JIRA)

unread,
Apr 15, 2020, 9:29:03 AM4/15/20
to jenkinsc...@googlegroups.com

gan.ainm@gmx.com (JIRA)

unread,
Apr 15, 2020, 9:32:03 AM4/15/20
to jenkinsc...@googlegroups.com
Gan Ainm edited a comment on Bug JENKINS-61850
Strangely, the build succeeds when the commit to be merged has been committed in the TFS git Git repository itself. When the change is pushed into the TFS git Git repository from a clone using a different user name and e-mail address, the pull request verification build fails as described above. Once user.name and user.email on the clone are set to be identical to the TFS git repo Git repository , the pull request verification build after the push succeeds. This seems really strange!

The error message is produced by the Jenkins Git plugin, so I assume _that_ is the source of the strange behavior.

gan.ainm@gmx.com (JIRA)

unread,
Apr 16, 2020, 11:42:03 AM4/16/20
to jenkinsc...@googlegroups.com
Gan Ainm edited a comment on Bug JENKINS-61850
Strangely, the build succeeds when the commit to be merged has been committed in the TFS Git repository itself. When the change is pushed into the TFS Git repository from a clone using a different user name and e-mail address, the pull request verification build fails as described above. Once user.name and user.email on the clone are set to be identical to the TFS Git repository, the pull request verification build after the push succeeds. This seems really strange!

Another thing is that the build succeeds when it is triggered by a Jenkins Service Hook in TFS but it fails if it is triggered by a TFS branch policy validation build.

The error message is produced by the Jenkins Git plugin, so I assume _that_ is the source of the strange behavior.

gan.ainm@gmx.com (JIRA)

unread,
Apr 17, 2020, 5:06:03 AM4/17/20
to jenkinsc...@googlegroups.com
Gan Ainm edited a comment on Bug JENKINS-61850
Strangely, the build succeeds when the commit to be merged has been committed in the TFS Git repository itself. When the change is pushed into the TFS Git repository from a clone using a different user name and e-mail address, the pull request verification build fails as described above. Once user.name and user.email on the clone are set to be identical to the TFS Git repository, the pull request verification build after the push succeeds. This seems really strange!

Another thing is that the build fails if it is triggered by a TFS branch policy validation build:

{noformat}
Checking out git http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git into /var/jenkins_home/workspace/verification-build@script to read Jenkinsfile

using credential c0c927b7-0a3a-4051-af13-91ef394cd497
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git # timeout=10
Fetching upstream changes from http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress -- http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin/pull/* # timeout=10
skipping resolution of commit 03420e8348cfad32cb7916e537a83b4654fbce9b, since it originates from another repository
> git rev-parse refs/remotes/origin/merge^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/merge^{commit} # timeout=10
> git rev-parse origin/merge^{commit} # timeout=10
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
ERROR: Maximum checkout retry attempts reached, aborting
Finished: FAILURE
{noformat}

However, it
succeeds when it is triggered by a Jenkins Service Hook in TFS but it fails if it :
{noformat}
Checking out git http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git into /var/jenkins_home/workspace/verification-build@script to read Jenkinsfile
using credential c0c927b7-0a3a-4051-af13-91ef394cd497
> git rev-parse --
is -inside-work-tree # timeout=10

Fetching changes from the remote Git repository
> git config remote.origin.url http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git # timeout=10
Fetching upstream changes from http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress -- http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin/pull/* # timeout=10
> git rev-parse c607f67f5388726e9b8aa8f04768214e8f5ba5c4^{commit} # timeout=10
> git branch -a -v --no-abbrev --contains c607f67f5388726e9b8aa8f04768214e8f5ba5c4 # timeout=10
Checking out Revision c607f67f5388726e9b8aa8f04768214e8f5ba5c4 (origin/pull/19/merge)

> git config core.sparsecheckout # timeout=10
> git checkout -f c607f67f5388726e9b8aa8f04768214e8f5ba5c4 # timeout=10
Commit message: "Merge pull request 19 from feature-one into master"
First time build. Skipping changelog.

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/verification-build

[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
using credential c0c927b7-0a3a-4051-af13-91ef394cd497
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git # timeout=10
Fetching upstream changes from http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials
> git fetch --tags --progress -- http://10.0.2.2:8080/tfs/DefaultCollection/Jenkins-Git-Test/_git/testit.git +refs/heads/*:refs/remotes/origin/* +refs/pull/*:refs/remotes/origin/pull/* # timeout=10
> git rev-parse c607f67f5388726e9b8aa8f04768214e8f5ba5c4^{commit} # timeout=10
> git branch -a -v --no-abbrev --contains c607f67f5388726e9b8aa8f04768214e8f5ba5c4 # timeout=10
Checking out Revision c607f67f5388726e9b8aa8f04768214e8f5ba5c4 (origin/pull/19/merge)

> git config core.sparsecheckout # timeout=10
> git checkout -f c607f67f5388726e9b8aa8f04768214e8f5ba5c4 # timeout=10
Commit message: "Merge pull request 19 from feature-one into master"

[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] sh
+ cat README.md
# Test Repository

This repository has been set up for testing purposes only.

This is another line added to trigger a build.
And one more.

This change has also been done on the feature-one branch.
(First line removed)

Last entry on feature-one.
2020-04-16T15:08:13+00:00
TGIF!!!

[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
Finished: SUCCESS
{noformat}

The Git log output after the successful verification build triggered by a TFS the service hook (commit c607f67) the failed branch policy validation build . (pull request abandoned after failure) should have built commit 03420e8:

{noformat}
*   c607f67 (HEAD, origin/pull/19/merge) Merge pull request 19 from feature-one into master
|\  
| | *   03420e8 (origin/pull/18/merge) Merge pull request 18 from feature-one into master
| | |\  
| |/ /  
|/| /   
| |/    
| | *   8d28981 (origin/pull/17/merge) Merge pull request 17 from feature-one into master
| | |\  
| |/ /  
|/| /   
| |/    
| | *   7836f47 (origin/pull/16/merge) Merge pull request 16 from feature-one into master
| | |\  
| |/ /  
|/| /   
| |/    
| * e7d5c43 (origin/feature-one) Thank God it's friday
{noformat}

The error message is produced by the Jenkins Git plugin, so I assume _that_ is the source of the strange behavior.

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

unread,
Apr 20, 2020, 10:35:02 PM4/20/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages