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

Cannot find any revision to build on clean workspace

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None

      GitHub pull request #18 of commit 486141bdb491f51b5d0bf0e3dc2a822b59ab755b automatically merged.
      Building on master in workspace /var/lib/jenkins/workspace/ghprb-test
      Cloning the remote Git repository
      Cloning repository https://github.com/tdiesler/fuse.git
      git --version
      git version 1.8.3.2
      ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
      Finished: FAILURE
      

          [JENKINS-20502] Cannot find any revision to build on clean workspace

          oeuftete added a comment -

          Seeing this as well. For a given pull request that has been updated a few times, the builds that succeeded triggered like this:

          Nov 14, 2013 3:46:09 PM org.jenkinsci.plugins.ghprb.GhprbRepository createCommitStatus
          INFO: Setting status of (SHA) to PENDING with url null and message:  Build triggered.
          

          Those that failed:

          Nov 14, 2013 4:11:09 PM org.jenkinsci.plugins.ghprb.GhprbRepository createCommitStatus
          INFO: Setting status of (SHA) to PENDING with url null and message:  Merged build triggered.
          

          So maybe the "Build" vs. "Merged build" determination is relevant.

          oeuftete added a comment - Seeing this as well. For a given pull request that has been updated a few times, the builds that succeeded triggered like this: Nov 14, 2013 3:46:09 PM org.jenkinsci.plugins.ghprb.GhprbRepository createCommitStatus INFO: Setting status of (SHA) to PENDING with url null and message: Build triggered. Those that failed: Nov 14, 2013 4:11:09 PM org.jenkinsci.plugins.ghprb.GhprbRepository createCommitStatus INFO: Setting status of (SHA) to PENDING with url null and message: Merged build triggered. So maybe the "Build" vs. "Merged build" determination is relevant.

          oeuftete added a comment -

          JENKINS-20231 looks like it might be related. The clean workspace being relevant (and not the Gerrit-related part).

          oeuftete added a comment - JENKINS-20231 looks like it might be related. The clean workspace being relevant (and not the Gerrit-related part).

          Code changed in jenkins
          User: Nicolas De Loof
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          http://jenkins-ci.org/commit/git-plugin/cf9dd72d9e7c242ae68fd1f6f65048691fab2a28
          Log:
          JENKINS-20502 enforce configured refspecs have been fetched
          clone don't handle custom refspecs, so need to run fetch

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/cf9dd72d9e7c242ae68fd1f6f65048691fab2a28 Log: JENKINS-20502 enforce configured refspecs have been fetched clone don't handle custom refspecs, so need to run fetch

          Simon Lynen added a comment -

          Nicolas, this is great! Thanks a lot for fixing this.

          Simon Lynen added a comment - Nicolas, this is great! Thanks a lot for fixing this.

          cb372 added a comment -

          Unfortunately, this does not seem to be fixed (for me, at least) in 2.0.1.

          Steps to reproduce:

          1. Create a new job. Use a git repo with multiple branches. Set the 'Branches to build > Branch specifier' to a specific branch, e.g. 'feature/my-feature'

          2. Run a build

          Result:

          Building in workspace /var/lib/jenkins/main/jobs/JOB_NAME/workspace
          Fetching changes from the remote Git repository
          Fetching upstream changes from ssh://...REPO URL...
          ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
          Finished: FAILURE
          

          Notes:

          • the clone works fine if I don't specify a branch
          • even after a successful clone, if I edit the job config to specify a branch, it fails with the same error as above.

          I don't know much about the internals of the Git plugin, but it looks like it's not doing a fetch, so it doesn't know what remote branches are available.

          cb372 added a comment - Unfortunately, this does not seem to be fixed (for me, at least) in 2.0.1. Steps to reproduce: 1. Create a new job. Use a git repo with multiple branches. Set the 'Branches to build > Branch specifier' to a specific branch, e.g. 'feature/my-feature' 2. Run a build Result: Building in workspace /var/lib/jenkins/main/jobs/JOB_NAME/workspace Fetching changes from the remote Git repository Fetching upstream changes from ssh://...REPO URL... ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. Finished: FAILURE Notes: the clone works fine if I don't specify a branch even after a successful clone, if I edit the job config to specify a branch, it fails with the same error as above. I don't know much about the internals of the Git plugin, but it looks like it's not doing a fetch, so it doesn't know what remote branches are available.

          cb372 added a comment -

          Found a workaround:

          1. Leave the 'Branches to build > Branch specifier' field blank

          2. Click the Advanced button, and set a custom refspec:

          +refs/heads/feature/my-feature:refs/remotes/origin/feature/my-feature
          

          With these settings, the plugin will correctly perform a fetch and then check out only the 'feature/my-feature' branch.

          cb372 added a comment - Found a workaround: 1. Leave the 'Branches to build > Branch specifier' field blank 2. Click the Advanced button, and set a custom refspec: +refs/heads/feature/my-feature:refs/remotes/origin/feature/my-feature With these settings, the plugin will correctly perform a fetch and then check out only the 'feature/my-feature' branch.

          David Vo added a comment -

          One small suggestion that worked for me - did you see if your Git plugin was "pinned" (to a previous version) after you upgraded to 2.0.1? I upgraded the plugin and thought I was good to go but as soon as I unpinned it, it worked. I clean the workspace before each build and I no longer see the error above.

          David Vo added a comment - One small suggestion that worked for me - did you see if your Git plugin was "pinned" (to a previous version) after you upgraded to 2.0.1? I upgraded the plugin and thought I was good to go but as soon as I unpinned it, it worked. I clean the workspace before each build and I no longer see the error above.

          cb372 added a comment -

          @David Vo, thanks for the tip, but the version is not pinned. It's definitely running version 2.0.1.

          cb372 added a comment - @David Vo, thanks for the tip, but the version is not pinned. It's definitely running version 2.0.1.

          Mark Waite added a comment -

          The git-client-plugin 1.10.0 supports refs/remotes/origin/master as a way to fully qualify the reference to the origin/master branch. Refer to the online help and to JENKINS-20767 for more information.

          Mark Waite added a comment - The git-client-plugin 1.10.0 supports refs/remotes/origin/master as a way to fully qualify the reference to the origin/master branch. Refer to the online help and to JENKINS-20767 for more information.

            ndeloof Nicolas De Loof
            tdiesler Thomas Diesler
            Votes:
            6 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: