sentry icon indicating copy to clipboard operation
sentry copied to clipboard

chore(scm): fill in get_file and check_file for Bitbucket and Azure DevOps

Open cathteng opened this issue 1 year ago • 0 comments

Current state of the SCM APIs implemented related to RepositoryMixin:

check_file get_file
GitHub Y Y
GitHub Enterprise Y Y
Gitlab Y Y
Bitbucket Y N
Bitbucket Server N N
Azure DevOps (VSTS) Y N

To make the abstraction easier we can fill the rest of these in. Besides Bitbucket Server, the check_file function is already implemented. The difference between check_file and get_file is that we just fully read the file (self.get with raw_response=True), possibly with a slightly different URL, see example implementation in Gitlab:

https://github.com/getsentry/sentry/blob/a0eca661fa254cb6af507d65bee97b1c999dd345/src/sentry/integrations/gitlab/client.py#L310-L327 https://github.com/getsentry/sentry/blob/a0eca661fa254cb6af507d65bee97b1c999dd345/src/sentry/integrations/gitlab/client.py#L329-L344

Notes

  • For Bitbucket, the check_file URL already returns the raw file (docs)
  • For Bitbucket Server, I referenced this to get the file: -- it seems that you need to add an extra ?raw parameter to fetch the raw file (and another reference to the ?raw part here
  • For AzureDevOps, it also looks like the original check_file URL works for get_file. You can add an extra param to download the file but we don't need that (docs)

This PR is useful for https://github.com/getsentry/sentry/pull/74908

cathteng avatar Aug 08 '24 21:08 cathteng