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

TFS pull request verification build uses wrong branch

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • tfs-plugin
    • None
    • Jenkins 2.222.1, TFS plugin 5.157.1

      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.

      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
      

            Unassigned Unassigned
            ganainm Gan Ainm
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: