Dependabot error with Bitbucket server Clients::Bitbucket::NotFound

1.1k views Asked by At

I have tried dependabot-script with Azure devops and had no big hurdles (I noticed Dependabot throws error repo not found when the I used user access token rather than system access token in ADO), but now trying with enterprise Bitbucket server I only see this error.

Has anyone experienced this error?

docker run --rm -v "$(pwd):/home/dependabot/dependabot-script" -w /home/dependabot/dependabot-script -e BITBUCKET_ACCESS_TOKEN=$BITBUCKET_ACCESS_TOKEN -e GITHUB_ACCESS_TOKEN=$GITHUB_ACCESS_TOKEN -e PACKAGE_MANAGER=npm_and_yarn -e PROJECT_PATH=projects/project_name/repos/repo_name bundle exec ruby ./generic-update-script.rb

Error /home/dependabot/dependabot-script/vendor/ruby/2.7.0/gems/dependabot-common-0.142.0/lib/dependabot/clients/bitbucket.rb:170:in `Clients::Bitbucket::NotFound)

2

There are 2 answers

1
Yarema On

I think the problem is in:

PROJECT_PATH=projects/project_name/repos/repo_name

You have to use

PROJECT_PATH=project_name/repo_name
0
rominator007 On

At the moment what you try to achieve seems not be implemented in dependabot.

I guess by the code at dependabot-core that bitbucket enterprise (by which I mean bitbucket installed in your company and not cloud) is not supported. Right at the bottom of the file it reads

def base_url
   # TODO: Make this configurable when we support enterprise Bitbucket
   "https://api.bitbucket.org/2.0/repositories/"
 end

Unfortunately I did not find further hints if this is really true.

The description of dependabot-script implies that you can set an api url and hostname via BITBUCKET_API_URL and BITBUCKET_HOSTNAME. The defaults there (api 2.0 and bitbucket.org show that they default to the bit bucket cloud API which I believe differs from the enterprise API (at least by the version).

I even tried some of the URLs that are assembled in the dependabot code and half of them work alright on the enterprise bitbucket and some don't (for example ../pullrequests which is used in the code does not work for me because the correct URL would be ../pull-requests on enterprise bitbucket)

I also checked with wireshark since I also tried to get this working and found that dependabot-script does send requests to bitbucket.org but not my enterprise bitbucket even when I set BITBUCKET_API_URL and BITBUCKET_HOSTNAME.