Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/ci/processable.rb')
-rw-r--r--app/models/ci/processable.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/models/ci/processable.rb b/app/models/ci/processable.rb
index d79ff74753a..f666629c8fd 100644
--- a/app/models/ci/processable.rb
+++ b/app/models/ci/processable.rb
@@ -101,6 +101,21 @@ module Ci
:merge_train_pipeline?,
to: :pipeline
+ def clone(current_user:)
+ new_attributes = self.class.clone_accessors.to_h do |attribute|
+ [attribute, public_send(attribute)] # rubocop:disable GitlabSecurity/PublicSend
+ end
+
+ if persisted_environment.present?
+ new_attributes[:metadata_attributes] ||= {}
+ new_attributes[:metadata_attributes][:expanded_environment_name] = expanded_environment_name
+ end
+
+ new_attributes[:user] = current_user
+
+ self.class.new(new_attributes)
+ end
+
def retryable?
return false if retried? || archived? || deployment_rejected?