• 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

       

          [JENKINS-46174] Error cloning remote from PR at first try

          Tim Downey added a comment -

          Hi.  I've since updated to Bitbucket Branch Source 2.2.7 and am seeing what may be a related issue.  I'm not receiving the error as described above, but am seeing ‘Jenkinsfile’ not found at least some of the time when PRs are triggdered.  Manually re-running the PR job works fine.

          Could this be related to JENKINS-45966?

           

          Tim Downey added a comment - Hi.  I've since updated to Bitbucket Branch Source 2.2.7 and am seeing what may be a related issue.  I'm not receiving the error as described above, but am seeing ‘Jenkinsfile’ not found at least some of the time when PRs are triggdered.  Manually re-running the PR job works fine. Could this be related to JENKINS-45966 ?  

          James Dumay added a comment -

          timdowney mind providing a new ticket with that error specifically?

          James Dumay added a comment - timdowney mind providing a new ticket with that error specifically?

          Tim Downey added a comment - - edited

          jamesdumay, thanks.  I've created JENKINS-48361.

          Tim Downey added a comment - - edited jamesdumay , thanks.  I've created JENKINS-48361 .

          James Dumay added a comment -

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

          James Dumay added a comment - marbon you wouldn't happen to be using Bitbucket Datacenter with mirrors would you?

          We are also hitting this issue with our Bitbucket Server installation

          Stephan Vedder added a comment - We are also hitting this issue with our Bitbucket Server installation

          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

          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

          tanzeelrehman, did you get solution for this ?

          surya vidiyala added a comment - tanzeelrehman , did you get solution for this ?

          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

          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

          Mark Strony added a comment -

          Hi,

          sometimes (not always) I've the same problem, however I'm on Bitbucket Server v7.7.1 and I've already enabled "Call Changes api".
          Which could be the problem?

           

           

          Mark Strony added a comment - Hi, sometimes (not always) I've the same problem, however I'm on Bitbucket Server v7.7.1 and I've already enabled "Call Changes api". Which could be the problem?    

          Nikolas Falco added a comment -

          Fix has been resolved and solution is available. If happens again please files a new bug with all required informations

          Nikolas Falco added a comment - Fix has been resolved and solution is available. If happens again please files a new bug with all required informations

            nfalco Nikolas Falco
            marbon marbon
            Votes:
            8 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: