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

Unable to build origin PRs with GitHub Branch Source Plugin: Couldn't find any revision to build

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Major Major
    • None

      I have created a freestyle multi-branch project, and I've configured it to use the GitHub branch source plugin as shown on the attached screenshot. With this I am unable to build origin pull requests (from the same repo). All builds fail with the message in the log below.

      How to reproduce:

      1. Start a clean Jenkins installation, possibly in a Docker container
      2. Install the github-branch-source-plugin and the multi-branch-project-plugin, possibly using install-plugins.sh multi-branch-project-plugin github-branch-source
      3. Add access credentials of the type Username with password using my predefined user with username jenkins-37144 and password 37144-jenkins. That is a GitHub user which has a repository with an open pull request.
      4. Create a Freestyle multi-branch project:
        1. Under Branch Sources, add GitHub as a source
        2. Configure jenkins-37144 as the owner
        3. Select the credentials from above
        4. Select jenkins-pr-test-repo as the repository
        5. Click Advanced... and make sure Build origin PRs (merged with base branch) is checked.
      5. Run the branch indexing for the job
      6. Run the job for the pull request and watch it fail with the error described below

      The build fails with this in the log:

       > git rev-parse origin/PR-27^{commit} # timeout=10
       > git rev-parse origin1/PR-27^{commit} # timeout=10
       > git rev-parse PR-27^{commit} # timeout=10
      ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
      Finished: FAILURE
      

      When running the same git commands manually, they fail as well, but providing origin/PR/27 instead of origin/PR-27 works:

      > git rev-parse origin/PR-27^{commit}
      fatal: ambiguous argument 'origin/PR-27^{commit}': unknown revision or path not in the working tree.
      > git rev-parse origin/PR/27^{commit}
      0bbc328a72b6083d593c1ae746f80fdba75aa61a
      

      Good to know:

      • All "non-PR" builds work fine.
      • Everything outside of the screenshot is configured according to the defaults.
      • The pull request exists and has no conflicts with the base branch.
      • The GitHub repository is my organization's private repository.
      • Builds are triggered by branch indexing.

            Unassigned Unassigned
            davidparsson David Pärsson
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: