Skip to content

Support Epic -> WorkItem sync of imported_from

Luke Duncalfe requested to merge 424454-epic-workitem-sync into master

What does this MR do and why?

Support Epic -> WorkItem sync of imported_from

!152092 (comment 1898690866) and #424454 (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.

How to set up and validate locally

One way to verify is to apply this patch:

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 3418570c3181..f3e8087088d2 100644
--- a/ee/app/services/concerns/epics/sync_as_work_item.rb
+++ b/ee/app/services/concerns/epics/sync_as_work_item.rb
@@ -11,7 +11,6 @@ module SyncAsWorkItem
     ALLOWED_PARAMS = %i[
       iid title description confidential author_id created_at updated_at updated_by_id
       last_edited_by_id last_edited_at closed_by_id closed_at state_id external_key
-      imported_from
     ].freeze

     def create_work_item_for!(epic)
diff --git a/ee/spec/lib/bulk_imports/groups/pipelines/epics_pipeline_spec.rb b/ee/spec/lib/bulk_imports/groups/pipelines/epics_pipeline_spec.rb
index ea672c6df915..ad4b7edfdae5 100644
--- a/ee/spec/lib/bulk_imports/groups/pipelines/epics_pipeline_spec.rb
+++ b/ee/spec/lib/bulk_imports/groups/pipelines/epics_pipeline_spec.rb
@@ -53,6 +53,7 @@

         group.epics.each do |epic|
           expect(epic.work_item).not_to be_nil
+          expect(epic.work_item.imported_from).to eq('gitlab_migration')

           diff = Gitlab::EpicWorkItemSync::Diff.new(epic, epic.work_item, strict_equal: true)
           expect(diff.attributes).to be_empty

and run:

bundle exec rspec ee/spec/lib/bulk_imports/groups/pipelines/epics_pipeline_spec.rb:56

The spec should fail because the WorkItem does not have the imported_from value from the Epic.

Now, add imported_from back as an ALLOWED_PARAMS, and run the spec again. The spec should pass, as that property is now considered something to sync.

Related to #424454 (closed)

Edited by Luke Duncalfe

Merge request reports

Loading