Handle declined event for bitbucket server importer
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA
What does this MR do and why?
Handle declined event for bitbucket server importer. As discussed in this thread:
- Add "Closed by" actor
- Add the note
Changelog: added
Notes
- We need to manually use
MergeRequest::Metrics.find_or_initialize_by
(similar withBitbucketServerImport::Importers::PullRequestNotes::ApprovedEvent
), because:- The metric does not exist yet because callback in
MergeRequest
model is disabled for import
- The metric does not exist yet because callback in
- Changes are only made on the new code path. The old one
BitbucketServerImport::Importers::PullRequestNotesImporter
is not adjusted. See:
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
- Initial environment setup can follow this
- Prepare some data in Bitbucket Server (create a
DECLINED
MR) - Patch the code to allow localhost connection to Bitbucket Server local:
diff --git a/gems/gitlab-http/lib/gitlab/http_v2/url_blocker.rb b/gems/gitlab-http/lib/gitlab/http_v2/url_blocker.rb
index 99876c779539..06bd0c6b92cd 100644
--- a/gems/gitlab-http/lib/gitlab/http_v2/url_blocker.rb
+++ b/gems/gitlab-http/lib/gitlab/http_v2/url_blocker.rb
@@ -64,6 +64,9 @@ def validate_url_with_proxy!(
)
# rubocop:enable Metrics/ParameterLists
+ allow_localhost = true
+ allow_local_network = true
+
return Result.new(nil, nil, true) if url.nil?
raise ArgumentError, 'The schemes is a required argument' if schemes.blank?
- Tail the log file:
tail -f log/importer.log
- Go to
http://127.0.0.1:3000/import/bitbucket_server/status
- Click Import
- Check the
DECLINED
MR, should have an author (if the author exist in GitLab)
Edited by Ivan Sebastian