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

Error cloning remote from PR at first try

XMLWordPrintable

    • Pipeline - April 2018

      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

       

            rsandell rsandell
            marbon marbon
            Votes:
            8 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated: