uffizzi_core 2.1.10 → 2.1.12

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: 23709086570ed3f71d5441b405a89e549ef018701ee69860bf1e52a599b261f3
4
- data.tar.gz: 2253edd2072ab0f28d6634cda6f1f67d2dbfdd38afed8f6be641f653290663dc
3
+ metadata.gz: 566a4ac7c7432c2799c5ec99b9254b891b57f1dc824871ea08618c185a23b943
4
+ data.tar.gz: e873366901b73043ce453bcbec7573a6901f9652a7c06eb0d2de2e5de3c91902
5
5
  SHA512:
6
- metadata.gz: dbee92e8db6aedcd94d2d4cd795556782c23015858ed58bfaf28f2a99881e19944295402e6c95695f2d0e7c77b8138ce9e48d5902b02361d94e98d74a146a70f
7
- data.tar.gz: d430e40efbebcca7db9cdd92f84a27cb9632535b17d15ca48461463b9dc3997b1c017fa563525f76b37c92c4d6a11177cea19cda6606498aa72194c85a329de0
6
+ metadata.gz: 8f0104e86fea8ab38eeeb8b41a3b154967a1d04d7adffd923dec5aadeea9a079eb9b22c37a65b3741a3f5663359bae80c03ba3adceafe749f90e3daa7bc7fbb8
7
+ data.tar.gz: f8720202fdb34be5d0445bee562f1a76c72b133d5ad41a46d1c99dbbb53e74be51726804043c291dae6d1d7b650b757ab22e41e53bbadeaa63b2e2cad75136d7
@@ -4,6 +4,8 @@ module UffizziCore::Concerns::Models::Membership
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
+ include AASM
8
+ include UffizziCore::StateMachineConcern
7
9
  include UffizziCore::MembershipRepo
8
10
  extend Enumerize
9
11
 
@@ -16,5 +18,18 @@ module UffizziCore::Concerns::Models::Membership
16
18
  belongs_to :user
17
19
 
18
20
  validates :role, presence: true
21
+
22
+ aasm(:state) do
23
+ state :active, initial: true
24
+ state :blocked
25
+
26
+ event :activate do
27
+ transitions from: [:blocked], to: :active
28
+ end
29
+
30
+ event :block do
31
+ transitions from: [:active], to: :blocked
32
+ end
33
+ end
19
34
  end
20
35
  end
@@ -5,5 +5,6 @@ module UffizziCore::MembershipRepo
5
5
 
6
6
  included do
7
7
  scope :by_role_admin, -> { by_role(UffizziCore::Membership.role.admin) }
8
+ scope :by_account, ->(account) { where(account_id: account.id) }
8
9
  end
9
10
  end
@@ -55,6 +55,10 @@ class UffizziCore::ActivityItemService
55
55
  notification_module.notify_about_failed_deployment(deployment) if notification_module.present?
56
56
  end
57
57
 
58
+ if deployed?(status) && UffizziCore::ContainerService.ingress_container?(container)
59
+ deployment.update(last_deploy_at: last_event.created_at)
60
+ end
61
+
58
62
  return unless [UffizziCore::Event.state.building, UffizziCore::Event.state.deploying].include?(status)
59
63
 
60
64
  UffizziCore::Deployment::ManageDeployActivityItemJob.perform_in(5.seconds, activity_item.id)
@@ -79,5 +83,9 @@ class UffizziCore::ActivityItemService
79
83
  def failed?(status)
80
84
  status == UffizziCore::Event.state.failed
81
85
  end
86
+
87
+ def deployed?(status)
88
+ status == UffizziCore::Event.state.deployed
89
+ end
82
90
  end
83
91
  end
@@ -10,6 +10,8 @@ class UffizziCore::ContainerRegistry::AzureService
10
10
  client(credential).authenticated?
11
11
  end
12
12
 
13
+ def digest(*); end
14
+
13
15
  private
14
16
 
15
17
  def client(c)
@@ -14,6 +14,8 @@ class UffizziCore::ContainerRegistry::DockerRegistryService
14
14
  client(credential).authenticated?
15
15
  end
16
16
 
17
+ def digest(*); end
18
+
17
19
  private
18
20
 
19
21
  def client(credential)
@@ -10,6 +10,8 @@ class UffizziCore::ContainerRegistry::GithubContainerRegistryService
10
10
  client(credential).authenticated?
11
11
  end
12
12
 
13
+ def digest(*); end
14
+
13
15
  private
14
16
 
15
17
  def client(c)
@@ -55,6 +55,10 @@ class UffizziCore::ContainerService
55
55
  end.first
56
56
  end
57
57
 
58
+ def ingress_container?(container)
59
+ container.receive_incoming_requests?
60
+ end
61
+
58
62
  private
59
63
 
60
64
  def container_status(container, pods)
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddStateToMemberships < ActiveRecord::Migration[6.1]
4
+ def change
5
+ add_column(:uffizzi_core_memberships, :state, :string)
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddLastDeployAtToDeployments < ActiveRecord::Migration[6.1]
4
+ def up
5
+ add_column :uffizzi_core_deployments, :last_deploy_at, :datetime
6
+
7
+ UffizziCore::Deployment.where(last_deploy_at: nil).update_all('last_deploy_at = updated_at')
8
+ end
9
+
10
+ def down
11
+ remove_column :uffizzi_core_deployments, :last_deploy_at
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.1.10'
4
+ VERSION = '2.1.12'
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.1.10
4
+ version: 2.1.12
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: 2023-03-09 00:00:00.000000000 Z
12
+ date: 2023-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -1027,6 +1027,8 @@ files:
1027
1027
  - db/migrate/20220901110752_create_host_volume_files.rb
1028
1028
  - db/migrate/20220901165313_create_container_host_volume_files.rb
1029
1029
  - db/migrate/20220927113647_add_additional_subdomains_to_containers.rb
1030
+ - db/migrate/20230111000000_add_state_to_memberships.rb
1031
+ - db/migrate/20230306142513_add_last_deploy_at_to_deployments.rb
1030
1032
  - db/seeds.rb
1031
1033
  - lib/tasks/uffizzi_core_tasks.rake
1032
1034
  - lib/uffizzi_core.rb