Skip to content

Move all EE model differences to separate modules

In https://gitlab.com/gitlab-org/release/framework/issues/28 we started working on determining what code might need to be refactored, where merge conflicts originate, etc. During this work I found out that there are quite a few files in EE that have EE specific changes beyond the usual prepend EE::Something line. This in turn can cause merge conflicts to happen if CE changes are made on the EE specific lines.

This issue contains a list of all files in EE (as of d464f52e) that change more than the addition of prepend EE::Something. In all cases, the EE specific changes should be moved to a corresponding module in the EE namespace, which is to be injected using prepend.

Changes per December 12, 2018

app/models/ci/pipeline.rb
diff --git a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/models/ci/pipeline.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/models/ci/pipeline.rb
index d06022a0fb7..f255aef0b60 100644
--- a/home/yorickpeterse/Projects/gitlab/gdk-ce/gitlab/app/models/ci/pipeline.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/app/models/ci/pipeline.rb
@@ -71,7 +71,8 @@ module Ci
     enum_with_nil config_source: {
       unknown_source: nil,
       repository_source: 1,
-      auto_devops_source: 2
+      auto_devops_source: 2,
+      webide_source: 3 ## EE-specific
     }
 
     # We use `Ci::PipelineEnums.failure_reasons` here so that EE can more easily
@@ -750,3 +751,5 @@ module Ci
     end
   end
 end
+
+Ci::Pipeline.prepend(EE::Ci::Pipeline)

Approach

The approach to this would be fairly straightforward. For every model:

  1. Move the prepend line to the end of the model, outside of the class block (https://gitlab.com/gitlab-org/gitlab-ee/issues/8241)
  2. Move all EE specific changes into the corresponding EE::X module (creating one if it doesn't exist)
  3. Most likely spend a lot of time dealing with specs failing in weird ways
Edited by Yorick Peterse