blob: d85d624fff319f25d9fe0409c34b60db1e958d13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# frozen_string_literal: true
module Deployable
extend ActiveSupport::Concern
included do
after_create :create_deployment
def create_deployment
return unless has_environment? && !has_deployment?
environment = project.environments.find_or_create_by(
name: expanded_environment_name
)
environment.deployments.create!(
project_id: environment.project_id,
environment: environment,
ref: ref,
tag: tag,
sha: sha,
user: user,
deployable: self,
on_stop: on_stop,
action: environment_action).tap do |_|
self.reload # Reload relationships
end
end
end
end
|