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

Error cloning remote from PR at first try

    XMLWordPrintable

    Details

    • Similar Issues:
    • Sprint:
      Pipeline - April 2018

      Description

      Creating a pull request leads to an ERROR because the pull request is not yet ready in bitbucket. If i start the build a few seconds later again, the build is successful.

       

      Branch event
      Checking out git ssh://git@bitbucket.example.com:7999/TEAM1/test-app.git into /home/tomcat/.jenkins/workspace/example-app_PR-25-GOOVLW2I7OWJHHOUS6SHBEULE2MRK5HY2FJWBLYL53I6ASFDQSJA@script to read Jenkinsfile
      Cloning the remote Git repository
      Cloning with configured refspecs honoured and without tags
      Cloning repository ssh://git@bitbucket.example.com:7999/TEAM1/test-app.git
       > git init /home/tomcat/.jenkins/workspace/example-app_PR-25-GOOVLW2I7OWJHHOUS6SHBEULE2MRK5HY2FJWBLYL53I6ASFDQSJA@script # timeout=10
      Fetching upstream changes from ssh://git@bitbucket.example.com:7999/TEAM1/test-app.git
       > git --version # timeout=10
      using GIT_SSH to set credentials
       > git fetch --no-tags --progress ssh://git@bitbucket.example.com:7999/TEAM1/test-app.git +refs/pull-requests/25/from:refs/remotes/origin/PR-25
      ERROR: Error cloning remote repo 'origin'
      hudson.plugins.git.GitException: Command "git fetch --no-tags --progress ssh://git@bitbucket.example.com:7999/TEAM1/test-app.git +refs/pull-requests/25/from:refs/remotes/origin/PR-25" returned status code 128:
      stdout:
      stderr: fatal: Couldn't find remote ref refs/pull-requests/25/from
      
         at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1924)
         at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1643)
         at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
         at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:352)
         at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:559)
         at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1075)
         at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1115)
         at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:113)
         at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:130)
         at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:120)
         at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:263)
         at hudson.model.ResourceController.execute(ResourceController.java:97)
         at hudson.model.Executor.run(Executor.java:419)
      [Bitbucket] Notifying pull request build result
      [Bitbucket] Build result notified
      ERROR: Error cloning remote repo 'origin'
      Finished: FAILURE
      

      Reproduction:

      • create a branch in the repository
      • create a new commit 
      • create a new pull request in Bitbucket server from the new branch to master
      • triggers a new build on jenkins -> fails with the above error
      • Start the build on jenkins manually a second time -> Is successful

       

        Attachments

          Issue Links

            Activity

            Hide
            jamesdumay James Dumay added a comment -

            marbon you wouldn't happen to be using Bitbucket Datacenter with mirrors would you?

            Show
            jamesdumay James Dumay added a comment - marbon you wouldn't happen to be using Bitbucket Datacenter with mirrors would you?
            Hide
            feliwir Stephan Vedder added a comment -

            We are also hitting this issue with our Bitbucket Server installation

            Show
            feliwir Stephan Vedder added a comment - We are also hitting this issue with our Bitbucket Server installation
            Hide
            tanzeelrehman tanzeel rehman added a comment -

            When I create a pull request in Bitbucket my build fails, see attached image for details. 

            Couldn't find remote ref refs/pull-requests/42/from
            • Another thing I have noticed is that when I go to Jenkins UI and re-trigger the build it builds without any errors.
            • Next if I commit to my branch/PR build runs without errors
            • Next when I decline the PR and then open the same PR it again fails and this time when I try to re trigger build from Jenkins UI it continues to fail with the same error and I end up with having to
              • create a new PR with the only solution to run my build pipeline, OR
              • I do a new commit  and that triggers a successful build

            My environments are: 

            • Jenkins ver. 2.197
            • Bitbucket Branch Source plugin 2.4.6

            Show
            tanzeelrehman tanzeel rehman added a comment - When I create a pull request in Bitbucket my build fails, see attached image for details.  Couldn't find remote ref refs/pull-requests/42/from Another thing I have noticed is that when I go to Jenkins UI and re-trigger the build it builds without any errors. Next if I commit to my branch/PR build runs without errors Next when I decline the PR and then open the same PR it again fails and this time when I try to re trigger build from Jenkins UI it continues to fail with the same error and I end up with having to create a new PR with the only solution to run my build pipeline, OR I do a new commit  and that triggers a successful build My environments are:  Jenkins ver. 2.197 Bitbucket Branch Source plugin 2.4.6
            Hide
            vsuryateja surya vidiyala added a comment -

            tanzeel rehman, did you get solution for this ?

            Show
            vsuryateja surya vidiyala added a comment - tanzeel rehman , did you get solution for this ?
            Hide
            counterdoc Marius Erlenbruch added a comment -

            We had the same error after upgrading to Bitbucket Server v7.x. You can fix it by setting "call changes api" in the system configuration of Jenkins.

            https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/docs/USER_GUIDE.adoc

            Show
            counterdoc Marius Erlenbruch added a comment - We had the same error after upgrading to Bitbucket Server v7.x. You can fix it by setting "call changes api" in the system configuration of Jenkins. https://github.com/jenkinsci/bitbucket-branch-source-plugin/blob/master/docs/USER_GUIDE.adoc

              People

              Assignee:
              rsandell rsandell
              Reporter:
              marbon marbon
              Votes:
              8 Vote for this issue
              Watchers:
              18 Start watching this issue

                Dates

                Created:
                Updated: