Add logger and custom errors for epic syncing
What does this MR do and why?
This refactors the SyncAsWorkItem
concern and adds a
SyncAsWorkItemError
to easily filter epic to work item syncing errors.
In addition, we added a custom logger for errors that could happen when
an epic gets synced as a work item and fixes an issue for reporting the wrong error messages.
This also tackles #439895 (closed)
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
- Apply the following patch to let the Work item update or creation fail:
- Go to epics and create one
- Check the log for the errors
- If you don't have a synced work item epic yet, go to
SyncAsWorkItem
concern and remove thecreate_params[:title] = nil
line we added with the patch to get a successful creation - Go to an epic with a synced work item and update it
- Check the logs for the errors
How to check logs
tail -f log/epic_work_item_sync.log
Patch to apply to create failures
diff --git a/ee/app/services/concerns/epics/sync_as_work_item.rb b/ee/app/services/concerns/epics/sync_as_work_item.rb
index f9822034f2f2..7ffe8ff3f151 100644
--- a/ee/app/services/concerns/epics/sync_as_work_item.rb
+++ b/ee/app/services/concerns/epics/sync_as_work_item.rb
@@ -53,6 +53,7 @@ def create_params(epic)
create_params[:title_html] = epic.title_html if params[:title].present?
create_params[:description_html] = epic.description_html if params[:description].present?
+ create_params[:title] = nil
create_params
end
@@ -68,6 +69,7 @@ def update_params(epic)
update_params[:title_html] = epic.title_html if params[:title].present?
update_params[:description_html] = epic.description_html if params[:description].present?
+ update_params[:title] = nil
update_params
end
Edited by Nicolas Dular