uffizzi_core 2.0.7 → 2.0.8

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: b54f2e35d7621917abd739768779233c577d81e336e3912afbea309acc082358
4
- data.tar.gz: 5115e2ccb4b5ac60a0774b90b414706af539dd373a7318ed0f6d28e28970b867
3
+ metadata.gz: ad9f3a6a719b85ce7b8ca7e577f9a53d948fd45be0c6691f9b10ad8d8fd2c362
4
+ data.tar.gz: d1d7268ea5bd02791d247889006561c40624f33d09cc96a2bb2b2cf71f6e0d8f
5
5
  SHA512:
6
- metadata.gz: fc8278ac3328a95f833316a109f96e9baf3b377a35b25679bf03447cf17d87a78ba83044127d90b065754834fa3acac0791747495b81b97b61919df53ec910d4
7
- data.tar.gz: a05cc0c6cffbe5366b7d896a50bef25bff6a1988b307bea804fe435b7965a86d179250d68b47b979a03132a0bb52427c7af2738b736fa12f006621d4e74f47bb
6
+ metadata.gz: 5beb449c4b58083379aaa6a2d03e4687b4262b7c9c889f75e11b8206ad712c2d46d723de67935ff50ff13a892b839c4659ce14b0c09b565da0b61937af127144
7
+ data.tar.gz: a9ce4450a1fc753307e23b208fba4dc3bcfc2c33f00de922c158139525d99a8acfdc506a4368c36aeb97ee1074085307bee9af4b7c9546a0b39728e87e4a6b0a
@@ -17,7 +17,7 @@ class UffizziCore::Api::Cli::V1::Account::Credential::CreateForm < UffizziCore::
17
17
  end
18
18
 
19
19
  def check_credential_correctness
20
- errors.add(:username, :incorrect) unless UffizziCore::CredentialService.correct_credentials?(self)
20
+ errors.add(:username, :incorrect, type: type.text) unless UffizziCore::CredentialService.correct_credentials?(self)
21
21
  end
22
22
 
23
23
  def credential_exists?
@@ -11,6 +11,15 @@ module UffizziCore::Concerns::Models::Credential
11
11
 
12
12
  self.table_name = UffizziCore.table_names[:credentials]
13
13
 
14
+ const_set(:CREDENTIAL_TYPES, [
15
+ 'UffizziCore::Credential::Amazon',
16
+ 'UffizziCore::Credential::Azure',
17
+ 'UffizziCore::Credential::DockerHub',
18
+ 'UffizziCore::Credential::DockerRegistry',
19
+ 'UffizziCore::Credential::GithubContainerRegistry',
20
+ 'UffizziCore::Credential::Google',
21
+ ])
22
+
14
23
  belongs_to :account
15
24
 
16
25
  before_destroy :remove_token
@@ -9,8 +9,8 @@ module UffizziCore::Concerns::Models::Event
9
9
 
10
10
  self.table_name = UffizziCore.table_names[:events]
11
11
 
12
- enumerize :state, in: [:queued, :successful, :deployed, :failed, :building, :timeout, :cancelled, :deploying], predicates: true,
13
- scope: true
12
+ enumerize :state, in: [:waiting, :queued, :successful, :deployed, :failed, :building, :timeout, :cancelled, :deploying],
13
+ predicates: true, scope: true
14
14
 
15
15
  belongs_to :activity_item, touch: true
16
16
  end
@@ -13,7 +13,6 @@ module UffizziCore::Concerns::Models::Repo
13
13
 
14
14
  belongs_to :project
15
15
  has_one :container, inverse_of: :repo, dependent: :destroy
16
- has_many :builds, dependent: :destroy
17
16
 
18
17
  validates :dockerfile_path, presence: true, if: :dockerfile?
19
18
  validates :delete_preview_after, numericality: { greater_than: 0, only_integer: true }, allow_nil: true
@@ -2,4 +2,7 @@
2
2
 
3
3
  class UffizziCore::Credential < UffizziCore::ApplicationRecord
4
4
  include UffizziCore::Concerns::Models::Credential
5
+
6
+ enumerize :type,
7
+ in: self::CREDENTIAL_TYPES, i18n_scope: ['enumerize.credential.type']
5
8
  end
@@ -12,7 +12,6 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentSerializer < UffizziCore::B
12
12
  :preview_url,
13
13
  :tag,
14
14
  :branch,
15
- :commit,
16
15
  :image_id,
17
16
  :ingress_container_ready,
18
17
  :ingress_container_state,
@@ -35,10 +34,6 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentSerializer < UffizziCore::B
35
34
  object.ingress_container&.repo&.branch
36
35
  end
37
36
 
38
- def commit
39
- object.ingress_container&.repo&.builds&.deployed&.last&.commit.to_s.slice(0..5)
40
- end
41
-
42
37
  def image_id
43
38
  object.ingress_container&.repo&.name
44
39
  end
@@ -9,15 +9,7 @@ class UffizziCore::Api::Cli::V1::Projects::Deployments::ContainerSerializer < Uf
9
9
 
10
10
  def name
11
11
  image_name = object.image.split('/').pop
12
- commit = object&.repo&.builds&.deployed&.last&.commit
13
- container_name = "#{image_name}:#{object.tag}"
14
-
15
- if !commit.nil?
16
- short_commit_hash = commit.slice(0..5)
17
- container_name = "#{container_name}@#{short_commit_hash}"
18
- end
19
-
20
- container_name
12
+ "#{image_name}:#{object.tag}"
21
13
  end
22
14
 
23
15
  def secret_variables
@@ -56,16 +56,11 @@ class UffizziCore::ManageActivityItemsService
56
56
  def build_container_status_items(network_connectivities, containers_replicas)
57
57
  containers.map do |container|
58
58
  network_connectivity = network_connectivities.detect { |item| item[:id] == container.id }
59
- any_container_is_building = containers_replicas.any? do |container_replicas|
60
- container_replicas[:items].any? do |item|
61
- item[:status] == UffizziCore::Event.state.building
62
- end
63
- end
64
59
  container_replicas = containers_replicas.detect { |item| item[:id] == container.id }
65
60
 
66
61
  {
67
62
  id: container.id,
68
- status: build_container_status(container, network_connectivity, container_replicas, any_container_is_building),
63
+ status: build_container_status(container, network_connectivity, container_replicas),
69
64
  }
70
65
  end
71
66
  end
@@ -74,9 +69,7 @@ class UffizziCore::ManageActivityItemsService
74
69
  replicas.any? { |replica| replica[:status] == status }
75
70
  end
76
71
 
77
- def build_container_status(container, network_connectivity, container_replicas, any_container_is_building)
78
- return building_container_status(container) if any_container_is_building
79
-
72
+ def build_container_status(container, network_connectivity, container_replicas)
80
73
  error = replicas_contains_status?(container_replicas[:items], UffizziCore::Event.state.failed)
81
74
  container_is_running = replicas_contains_status?(container_replicas[:items], UffizziCore::Event.state.deployed)
82
75
  deployed = !error && container_is_running
@@ -91,10 +84,6 @@ class UffizziCore::ManageActivityItemsService
91
84
  container_status(error, deployed)
92
85
  end
93
86
 
94
- def building_container_status(_container)
95
- UffizziCore::Event.state.deploying
96
- end
97
-
98
87
  def container_status(error, deployed)
99
88
  return UffizziCore::Event.state.failed if error
100
89
  return UffizziCore::Event.state.deployed if deployed
@@ -32,10 +32,6 @@ class UffizziCore::RepoService
32
32
  #{repo.project_id}:#{repo.id}")[0, 10]}"
33
33
  end
34
34
 
35
- def tag(repo)
36
- repo&.builds&.deployed&.last&.commit || 'latest'
37
- end
38
-
39
35
  def image(repo)
40
36
  repo_credential = credential(repo)
41
37
 
@@ -13,7 +13,7 @@ en:
13
13
  password:
14
14
  password_blank: Password/Access Token can't be blank
15
15
  username:
16
- incorrect: We were unable to log you in to docker registry. Please verify that your username and password are correct.
16
+ incorrect: "We were unable to log you into %{type}. Please verify that your username and password are correct."
17
17
  type:
18
18
  exist: Credential of that type already exist.
19
19
  uffizzi_core/deployment:
@@ -77,3 +77,12 @@ en:
77
77
  session:
78
78
  unsupported_login_type: This type of login is not supported
79
79
  unauthorized: Unauthorized
80
+ enumerize:
81
+ credential:
82
+ type:
83
+ "UffizziCore::Credential::GithubContainerRegistry": "Github Container Registry"
84
+ "UffizziCore::Credential::DockerHub": "DockerHub"
85
+ "UffizziCore::Credential::DockerRegistry": "Docker Registry"
86
+ "UffizziCore::Credential::Azure": "Azure"
87
+ "UffizziCore::Credential::Google": "Google"
88
+ "UffizziCore::Credential::Amazon": "Amazon"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.0.7'
4
+ VERSION = '2.0.8'
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.7
4
+ version: 2.0.8
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-10-26 00:00:00.000000000 Z
12
+ date: 2022-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -811,7 +811,6 @@ files:
811
811
  - app/jobs/uffizzi_core/deployment/update_credential_job.rb
812
812
  - app/lib/uffizzi_core/concerns/models/account.rb
813
813
  - app/lib/uffizzi_core/concerns/models/activity_item.rb
814
- - app/lib/uffizzi_core/concerns/models/build.rb
815
814
  - app/lib/uffizzi_core/concerns/models/comment.rb
816
815
  - app/lib/uffizzi_core/concerns/models/compose_file.rb
817
816
  - app/lib/uffizzi_core/concerns/models/config_file.rb
@@ -845,7 +844,6 @@ files:
845
844
  - app/models/uffizzi_core/activity_item/github.rb
846
845
  - app/models/uffizzi_core/activity_item/memory_limit.rb
847
846
  - app/models/uffizzi_core/application_record.rb
848
- - app/models/uffizzi_core/build.rb
849
847
  - app/models/uffizzi_core/comment.rb
850
848
  - app/models/uffizzi_core/compose_file.rb
851
849
  - app/models/uffizzi_core/config_file.rb
@@ -898,7 +896,6 @@ files:
898
896
  - app/repositories/uffizzi_core/account_repo.rb
899
897
  - app/repositories/uffizzi_core/activity_item_repo.rb
900
898
  - app/repositories/uffizzi_core/basic_order_repo.rb
901
- - app/repositories/uffizzi_core/build_repo.rb
902
899
  - app/repositories/uffizzi_core/comment_repo.rb
903
900
  - app/repositories/uffizzi_core/compose_file_repo.rb
904
901
  - app/repositories/uffizzi_core/config_file_repo.rb
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module UffizziCore::Concerns::Models::Build
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- include UffizziCore::BuildRepo
8
-
9
- self.table_name = UffizziCore.table_names[:builds]
10
-
11
- const_set(:BUILDING, 1)
12
- const_set(:SUCCESS, 2)
13
- const_set(:FAILED, 3)
14
- const_set(:TIMEOUT, 4)
15
- const_set(:CANCELLED, 5)
16
-
17
- belongs_to :repo
18
-
19
- def successful?
20
- status == self.class::SUCCESS
21
- end
22
-
23
- def unsuccessful?
24
- [self.class::FAILED, self.class::TIMEOUT, self.class::CANCELLED].include?(status)
25
- end
26
-
27
- def failed?
28
- status == self.class::FAILED
29
- end
30
-
31
- def building?
32
- status == self.class::BUILDING
33
- end
34
-
35
- def timed_out?
36
- status == self.class::TIMEOUT
37
- end
38
-
39
- def cancelled?
40
- status == self.class::CANCELLED
41
- end
42
-
43
- def ended?
44
- [self.class::SUCCESS, self.class::FAILED, self.class::TIMEOUT, self.class::CANCELLED].include?(status)
45
- end
46
- end
47
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class UffizziCore::Build < UffizziCore::ApplicationRecord
4
- include UffizziCore::Concerns::Models::Build
5
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module UffizziCore::BuildRepo
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- scope :successful, -> {
8
- where(status: UffizziCore::Build::SUCCESS)
9
- }
10
-
11
- scope :building, -> {
12
- where(status: UffizziCore::Build::BUILDING)
13
- }
14
-
15
- scope :queued, -> {
16
- where(status: [nil])
17
- }
18
-
19
- scope :deployed, -> {
20
- where(deployed: true)
21
- }
22
- end
23
- end