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

Bitbucket client fail to retrieve resource with HTTP 404 for bitbucket server

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • 934.3.2

      Running a pipeline cause a FileNotFoundException to be thrown after updating the Bitbucket Branch Source plugin from version 933.2.1 to >=933.3.0.

      The Jenkins instance is integrated with a Bitbucket Data Center instance and not a Cloud one.

      The file not found exception is thrown because the `pipeline_config.groovy` file is not found on the repository. The file is used by the Jenkins template engine (JTE) plugin (https://plugins.jenkins.io/templating-engine/) but it is not present in the repos because a default one is configured/provided.

      The Bitbucket branch source plugin was working correctly along with the Jenkins template engine (JTE) one for over 3 years till version 933.2.1.

      Having a brief look at the diff between 933.2.1 and version 933.3.0 reveals a lot of changes to the `com.cloudbees.jenkins.plugins.bitbucket.impl.client.AbstractBitbucketApi` class.
      The import for `java.io.FileNotFoundException` can be clearly seen along with the FileNotFound exception thrown on line 240 (the one in the logs I have attached).  Maybe, the previous behaviour was to ignore a 404 on that case.

      Attaching screenshots of the exception and the Bitbucket api endpoint called from the browser.

          [JENKINS-75157] Bitbucket client fail to retrieve resource with HTTP 404 for bitbucket server

          Giovanni DS created issue -

          Nikolas Falco added a comment -

          Could you provide me the URL that works in version 933.2.1 ? I would compare to see where the URL has been changed. In theory it should not but it's clear that is change by as side effect of changes related to share common behaviour between server and cloud client.

          Nikolas Falco added a comment - Could you provide me the URL that works in version 933.2.1 ? I would compare to see where the URL has been changed. In theory it should not but it's clear that is change by as side effect of changes related to share common behaviour between server and cloud client.

          Nikolas Falco added a comment -

          I had compare version and the only changes is how the Apache client is called. In a working version is passed only the request and http context, in the latest version also the HttpHost. I'm preparing a PR to replicated working version. I would ask to you to install incremental version from that PR and report to me if works.
          My company use cloud version (on which I test before rollout a version) so server instance is not covered expect by unit test.

          Nikolas Falco added a comment - I had compare version and the only changes is how the Apache client is called. In a working version is passed only the request and http context, in the latest version also the HttpHost. I'm preparing a PR to replicated working version. I would ask to you to install incremental version from that PR and report to me if works. My company use cloud version (on which I test before rollout a version) so server instance is not covered expect by unit test.
          Nikolas Falco made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Nikolas Falco made changes -
          Summary Original: Bitbucket Branch Source plugin file not found exception since version 933.3.0 New: Bitbucket client fail to retrieve resource with HTTP 404 for bitbucket server
          Nikolas Falco made changes -
          Remote Link New: This issue links to "PR (Web Link)" [ 30495 ]

          Nikolas Falco added a comment -

          Nikolas Falco added a comment - The link to incremental build of the plugin produced by this jenkins job: https://ci.jenkins.io/job/Plugins/job/bitbucket-branch-source-plugin/view/change-requests/job/PR-970/
          Giovanni DS made changes -

          Giovanni DS added a comment -

          HI nfalco,
          I have installed and tested the incremental version as you requested me. Unfortunately it is not working, it looks like the same error to me.
          Obviously, the strack trace is slightly different as some changes were made to the code. I am adding the screenshot as a new attachment on the task.
          I cannot provide you the URL that works because it looks like nothing is logged when I revert to version 933.2.1.

          Giovanni DS added a comment - HI nfalco , I have installed and tested the incremental version as you requested me. Unfortunately it is not working, it looks like the same error to me. Obviously, the strack trace is slightly different as some changes were made to the code. I am adding the screenshot as a new attachment on the task. I cannot provide you the URL that works because it looks like nothing is logged when I revert to version 933.2.1.

          Nikolas Falco added a comment -

          Thank to have tried. Seems the issue was catched by kon and this night I will provide the strict changes to release a 934.3.2.
          The suggested refactor of SCMFile will be done in master with the fix, for which i see other logic must to be changed.

          Nikolas Falco added a comment - Thank to have tried. Seems the issue was catched by kon and this night I will provide the strict changes to release a 934.3.2. The suggested refactor of SCMFile will be done in master with the fix, for which i see other logic must to be changed.

            nfalco Nikolas Falco
            giovannids Giovanni DS
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: