Bitbucket Cloud: Safe handling of issue refs
What does this MR do and why?
When notes are imported from Bitbucket, it can contain references (links) to MRs, issues, etc. but these point to the Bitbucket urls so it's not useful. We therefore convert the refs to gitlab refs.
There is one case that was missed: when the link is for issues but not a specific issue e.g. https://gitlab.com/gitlab-org/gitlab/-/issues. This MR fixes that by updating the regex to look for issue names instead of values after the last backslash. A spec was also added to test this.
This happened 51 times in the last 7 days (ref)
How to set up and validate locally
- Follow https://docs.gitlab.com/ee/integration/bitbucket.html to setup OAuth for BitBucket Cloud. You will need an account on https://bitbucket.org/ that uses the same email address as the account on the
gdk
instance. You may need to create a new user on thegdk
for this. - Make sure you add the bitbucket configuration in the
development
section of yourconfig/gitlab.yml
as shown at https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/gitlab-oauth2.md#set-up-gdk:development: <<: *base omniauth: providers: - { name: 'bitbucket', app_id: '...', app_secret: '...' }
- Log into the
gdk
with the relevant user credentials and in...-/profile/account
connect bitbucket there:
- Create a project and repo on BitBucket. Create an MR and add a note with a reference to issues
https://bitbucket.org/<project>/<repo>/issues
and specific issues. - Enable the feature flag:
Feature.enable(:bitbucket_parallel_importer)
- On your
gdk
instance, create a new project > click onImport project
>Bitbucket Cloud
> follow instructions to connect to https://bitbucket.org/. - Import the project.
- Verify that the refs in the notes were successfully converted to gitlab refs.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #412614 (closed)
Edited by Madelein van Niekerk