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

ERROR: Could not do lightweight checkout, falling back to heavyweight

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Jenkins 2.104
      Jenkins Bitbucket Branch Source Plugin 2.2.9
      Bitbucket Server 5.6.0
    • Similar Issues:

      Description

      When building a PR that hasn't had changes to the Jenkinsfile within the PR, we see the following error at the beginning of each build:

      Branch event
      ERROR: Could not do lightweight checkout, falling back to heavyweight
      java.io.FileNotFoundException: URL: /rest/api/1.0/projects/TCD/repos/deployer-ish/browse/Jenkinsfile?at=PR-216&start=0&limit=500
      	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:628)
      	at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getFileContent(BitbucketServerAPIClient.java:867)
      	at com.cloudbees.jenkins.plugins.bitbucket.filesystem.BitbucketSCMFile.content(BitbucketSCMFile.java:99)
      	at jenkins.scm.api.SCMFile.contentAsString(SCMFile.java:338)
      	at org.jenkinsci.plugins.workflow.multibranch.SCMBinder.create(SCMBinder.java:104)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:271)
      	at hudson.model.ResourceController.execute(ResourceController.java:97)
      	at hudson.model.Executor.run(Executor.java:429)
      

      This is because Bitbucket Server does not expose the Jenkinsfile on such a PR, i.e.

      // 20180203112420
      // https://stash.my.com//rest/api/1.0/projects/TCD/repos/deployer-ish/browse/Jenkinsfile?at=PR-216&start=0&limit=500
      
      {
        "errors": [
          {
            "context": null,
            "message": "The path \"Jenkinsfile\" does not exist at revision \"PR-216\"",
            "exceptionName": "com.atlassian.bitbucket.content.NoSuchPathException"
          }
        ]
      }
      

      This should not be an error, as if there are no changes to the Jenkinsfile, then Bitbucket will not include the file on that request.

        Attachments

          Issue Links

            Activity

            Hide
            sharathkumar730 sharath mogadari added a comment -

            I am also facing exactly the same issue and I really hope that there is a workaround available for this. A possible hot fix (before the actual issue gets fixed) can be: 

            • Provide an option in the Jenkins UI to explicitly go for a heavyweight checkout (when Bitbucket Source is chosen). Don't make a call to this API /rest/api/1.0/projects/PROJNAME/repos/REPONAME/browse/Jenkinsfile?at=PR-51&start=0&limit=500 every time a PR is submitted (i.e. when this option for heavyweight checkout is checked or when a option for lightweight checkout is unchecked). 

            Also, please solve this issue or as I mentioned above, please provide an option (a checkbox maybe in the Jenkins UI) to go for a heavyweight checkout. We don't need the lightweight checkout feature and we would be happy to go with a heavyweight checkout. 

            Thanks

            Show
            sharathkumar730 sharath mogadari added a comment - I am also facing exactly the same issue and I really hope that there is a workaround available for this. A possible hot fix (before the actual issue gets fixed) can be:  Provide an option in the Jenkins UI to explicitly go for a heavyweight checkout (when Bitbucket Source is chosen). Don't make a call to this API /rest/api/1.0/projects/PROJNAME/repos/REPONAME/browse/Jenkinsfile?at=PR-51&start=0&limit=500 every time a PR is submitted (i.e. when this option for heavyweight checkout is checked or when a option for lightweight checkout is unchecked).  Also, please solve this issue or as I mentioned above, please provide an option (a checkbox maybe in the Jenkins UI) to go for a heavyweight checkout . We don't need the lightweight checkout feature and we would be happy to go with a heavyweight checkout.  Thanks
            Hide
            fasmat Matthias F added a comment -

            Same here, the URL uses a wrong parameter (PR-XXX) instead of the branch name. I couldn't find any parameter that would me allow to change that.

            Show
            fasmat Matthias F added a comment - Same here, the URL uses a wrong parameter (PR-XXX) instead of the branch name. I couldn't find any parameter that would me allow to change that.
            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
            • JENKINS-59808

            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 JENKINS-59808
            Hide
            bitwiseman Liam Newman added a comment - - edited

            It is likely that the ref is being cleaned up by BitBucket.  As shown by https://issues.jenkins-ci.org/browse/JENKINS-61493 , Atlassian treated the merge ref as an implementation detail that should not be depended on.  

            See that issue for workaround.

            Show
            bitwiseman Liam Newman added a comment - - edited It is likely that the ref is being cleaned up by BitBucket.  As shown by https://issues.jenkins-ci.org/browse/JENKINS-61493  , Atlassian treated the merge ref as an implementation detail that should not be depended on.   See that issue for workaround.
            Hide
            bitwiseman Liam Newman added a comment -

            I believe this issue was fixed by https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/409 and released in v2.9.6. Could someone please try this and verify whether this is so?

            Show
            bitwiseman Liam Newman added a comment - I believe this issue was fixed by https://github.com/jenkinsci/bitbucket-branch-source-plugin/pull/409 and released in v2.9.6. Could someone please try this and verify whether this is so?

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              bengineer Ben Middleton
              Votes:
              24 Vote for this issue
              Watchers:
              31 Start watching this issue

                Dates

                Created:
                Updated: