diff options
Diffstat (limited to 'app/models/ci/processable.rb')
-rw-r--r-- | app/models/ci/processable.rb | 15 |
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? |