Extract EE specific files/lines for lib/gitlab/ci
We have the following files containing EE specific code. We should move them to ee/
lib/gitlab/ci/model.rb
diff --git a/lib/gitlab/ci/model.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/ci/model.rb
index fbdb84c0522..1625cb841b6 100644
--- a/lib/gitlab/ci/model.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/ci/model.rb
@@ -8,7 +8,7 @@ module Gitlab
end
def model_name
- @model_name ||= ActiveModel::Name.new(self, nil, self.name.split("::").last)
+ @model_name ||= ActiveModel::Name.new(self, nil, self.name.demodulize)
end
end
end
lib/gitlab/ci/pipeline/chain/command.rb
diff --git a/lib/gitlab/ci/pipeline/chain/command.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/ci/pipeline/chain/command.rb
index e4ed1424865..222e4888ba0 100644
--- a/lib/gitlab/ci/pipeline/chain/command.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/ci/pipeline/chain/command.rb
@@ -11,7 +11,10 @@ module Gitlab
:trigger_request, :schedule, :merge_request,
:ignore_skip_ci, :save_incompleted,
:seeds_block, :variables_attributes, :push_options,
- :chat_data
+ :chat_data,
+
+ # EE specific
+ :allow_mirror_update
) do
include Gitlab::Utils::StrongMemoize
lib/gitlab/ci/pipeline/chain/validate/abilities.rb
diff --git a/lib/gitlab/ci/pipeline/chain/validate/abilities.rb b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/ci/pipeline/chain/validate/abilities.rb
index ebd7e6e8289..8efc46c0807 100644
--- a/lib/gitlab/ci/pipeline/chain/validate/abilities.rb
+++ b/home/yorickpeterse/Projects/gitlab/gdk-ee/gitlab/lib/gitlab/ci/pipeline/chain/validate/abilities.rb
@@ -14,6 +14,10 @@ module Gitlab
return error('Pipelines are disabled!')
end
+ if @command.allow_mirror_update && !project.mirror_trigger_builds?
+ return error('Pipeline is disabled for mirror updates')
+ end
+
unless allowed_to_trigger_pipeline?
if can?(current_user, :create_pipeline, project)
return error("Insufficient permissions for protected ref '#{command.ref}'")