uffizzi_core 2.0.14 → 2.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3f418bff9703cbe59f1ee9a69e52f14aa1ad2824a4118ad4b6d97c703347243
4
- data.tar.gz: e9d6492698a43db8833b1175c10b95054d2b2c4230ade5aeee0d7ca49640ba1e
3
+ metadata.gz: 28934eb7317d49a31d36b7563e17536b0cb9ce375a7c92d4ef7102f2eb3f998f
4
+ data.tar.gz: f86564b713075d3762622329be0d96333cc6a8a5f7c1f9352a06f26d746c89d4
5
5
  SHA512:
6
- metadata.gz: 981763aac83a419775db0130ac7b984e896fc36a11170c69c9f28d2045e5fd4024f74c3fafc538fa88a955b964377976845a0793b8e373e409ab6e3acc7e0bbd
7
- data.tar.gz: 16a2fe83f500ab8e56ce259a978ea6a6318d1de83027edb71f06205156eb8d98fb24b27ab758262b06c2fb7696199e4c40a91da87b71405df94ad37a469430cf
6
+ metadata.gz: 21f814b2a44d75f89128e33fb067fa56c7f83fda3a5ca7938fc026108b95d6056d405cf38da15730d593756b1479cd297c6c5f66865eb85c8b5c5bbae2a4b23f
7
+ data.tar.gz: 3cc681f0cde118c45ebf0b07d240f70cb8690a4a4ed399421d1d07f6524fa1de7b214a3ca97a39950584c69bafe0b7166c8482ced38b065fc79441f3c72de83a
@@ -31,6 +31,12 @@ module UffizziCore::DependencyInjectionConcern
31
31
  module_class(:ingress_parser)
32
32
  end
33
33
 
34
+ def notification_module
35
+ return unless module_exists?(:notification_module)
36
+
37
+ module_class(:notification_module)
38
+ end
39
+
34
40
  private
35
41
 
36
42
  def module_exists?(module_name)
@@ -47,7 +47,7 @@ module UffizziCore::Concerns::Models::Deployment
47
47
  transitions from: [:disabled], to: :active
48
48
  end
49
49
 
50
- event :fail, after: :after_fail do
50
+ event :fail do
51
51
  transitions from: [:active], to: :failed
52
52
  end
53
53
 
@@ -61,10 +61,6 @@ module UffizziCore::Concerns::Models::Deployment
61
61
  update!(disabled_at: Time.now)
62
62
  end
63
63
 
64
- def after_fail
65
- active_containers.each(&:disable!)
66
- end
67
-
68
64
  def clean
69
65
  active_containers.each(&:disable!)
70
66
  UffizziCore::Deployment::DeleteJob.perform_async(id)
@@ -4,6 +4,8 @@ class UffizziCore::ActivityItemService
4
4
  COMPLETED_STATES = ['deployed', 'failed', 'cancelled'].freeze
5
5
 
6
6
  class << self
7
+ include UffizziCore::DependencyInjectionConcern
8
+
7
9
  def create_docker_item!(repo, container)
8
10
  activity_item_attributes = {
9
11
  namespace: repo.namespace,
@@ -27,8 +29,9 @@ class UffizziCore::ActivityItemService
27
29
 
28
30
  def fail_deployment!(activity_item)
29
31
  deployment = activity_item.container.deployment
32
+ last_event = activity_item.events.order_by_id.last
30
33
 
31
- activity_item.events.create(state: UffizziCore::Event.state.failed)
34
+ activity_item.events.create(state: UffizziCore::Event.state.failed) unless last_event&.failed?
32
35
 
33
36
  UffizziCore::DeploymentService.fail!(deployment)
34
37
  end
@@ -55,6 +58,11 @@ class UffizziCore::ActivityItemService
55
58
 
56
59
  activity_item.events.create(state: status) if last_event&.state != status
57
60
 
61
+ if failed?(status)
62
+ UffizziCore::ActivityItemService.fail_deployment!(activity_item)
63
+ notification_module.notify_about_failed_deployment(deployment) if notification_module.present?
64
+ end
65
+
58
66
  return unless [UffizziCore::Event.state.building, UffizziCore::Event.state.deploying].include?(status)
59
67
 
60
68
  UffizziCore::Deployment::ManageDeployActivityItemJob.perform_in(5.seconds, activity_item.id)
@@ -75,5 +83,9 @@ class UffizziCore::ActivityItemService
75
83
  last_event = activity_item.events.last
76
84
  COMPLETED_STATES.include?(last_event.state)
77
85
  end
86
+
87
+ def failed?(status)
88
+ status == UffizziCore::Event.state.failed
89
+ end
78
90
  end
79
91
  end
@@ -135,7 +135,7 @@ class UffizziCore::DeploymentService
135
135
  end
136
136
 
137
137
  def build_deployment_url(deployment)
138
- "#{Settings.app.managed_dns_zone}/projects/#{deployment.project_id}/deployments"
138
+ "#{Settings.app.host}/projects/#{deployment.project_id}/deployments"
139
139
  end
140
140
 
141
141
  def all_containers_have_unique_ports?(containers)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.0.14'
4
+ VERSION = '2.0.15'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uffizzi_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.14
4
+ version: 2.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Thurman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-12-01 00:00:00.000000000 Z
12
+ date: 2022-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm