Refactoring merge train refresh service
What does this MR do?
This MR resolves the ~"technical debt" around merge train refreshing service. Specifically,
- Improve the readability on
MergeTrainclass to returnMergeTrainobject ascar. The complete terminology refactoring will be done in #298541 (closed). - Remove the debug-logging in the
RefreshMergeRequestsServiceas the culprit was identified and resolved a long time ago. - Remove unused/dead code for better readability
- Rename
RefreshMergeRequestsServicetoMergeTrains::RefreshService. -
MergeTrains::RefreshServiceis the single service to refresh all merge requests on a train. -
MergeTrains::RefreshServicereceivestarget_project_idandtarget_branchas arguments as the definition of a train. Previously, it receivedmerge_requestobject but it's no longer relevant after the process change. - Introduce
MergeTrains::RefreshWorkeras the single worker to executeMergeTrains::RefreshServiceservice.- This comes with sidekiq job deduplication to drop the redundant jobs. This is more efficient.
- Reduce redundant database queries.
- Add an explanation on the
RefreshMergeTrainServiceprocess flow.
Close #281065 (closed)
Related !49520 (merged)
Manual QA
- Conditions:
- Create a sample project
- Created 10 MRs and add to the merge train
for i in {1..10}; do
export identifier=$(date +%s) &&
git checkout master &&
git co -b "feature-$identifier" &&
echo 'a' > $identifier.txt &&
git add . &&
git commit -m "Test MR $identifier" &&
git push origin -o merge_request.create
done
- Expectations:
- All MRs are merged.
- Both
auto_merge:auto_merge_processandauto_merge:merge_trains_refreshworker jobs are correctly processed.
- Result: PASS
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec -
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Shinya Maeda