uffizzi_core 2.1.25 → 2.1.27

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: 891fe1a03e5dd0dbc635156b946213cbedef67a792537d706e7247ec241c8c7a
4
- data.tar.gz: a81611e8aa150c0d6bf1ac9f3bdbd549aefdfcfc1434f3ebe68688488bd509b8
3
+ metadata.gz: 5a8a1183efec864646047c9f61ae530737b409a1053d35a784064f85644debc5
4
+ data.tar.gz: 1e379b56a9dbbd9359d9465d804e7006674033b2ce1ca044b100e180b7950804
5
5
  SHA512:
6
- metadata.gz: 7de4b67a8fc79849717ac31c2e74511d8c017dad1adc70cdc94dc83ab022290c819dfd7cf68fda8b411399ec7b39efd0f774e351daecd25845cc84f82879cf33
7
- data.tar.gz: '028258a7a6c4550b9921642df1d38e8ef3e87e63b0f95fefbb866eaf46614df97b114f6bf51fdfa82ff0190ed2abcf910a4602ada23e6850a6ddedbfa1fdd603'
6
+ metadata.gz: 7ac9e06c7d871c1ed0a3d6e91b6e15118cf99048828777a9aca540c871327234dc2b839db691da579476b33edccb56682c05ec98461e177e30a2bde65f4a1a8f
7
+ data.tar.gz: 80b8a0283c69a1f0a74d32d33301030d1b6f5794817b33d12523a6a91df7426c22af96168cea50a6576268a7df8806118c196115797ce646f0d4beee48115777
@@ -12,18 +12,18 @@ class UffizziCore::DockerRegistryClient
12
12
 
13
13
  def initialize(registry_url:, username: nil, password: nil)
14
14
  @registry_url = registry_url
15
- @connection = build_connection(@registry_url, username, password)
15
+ @connection = build_connection(username, password)
16
16
  end
17
17
 
18
18
  def authenticated?
19
- @connection.head('/v2/')
19
+ @connection.get("#{@registry_url}/v2/")
20
20
 
21
21
  true
22
22
  end
23
23
 
24
24
  def manifests(image:, tag:, namespace: nil)
25
25
  full_image = [namespace, image].compact.join('/')
26
- url = "/v2/#{full_image}/manifests/#{tag}"
26
+ url = "#{@registry_url}/v2/#{full_image}/manifests/#{tag}"
27
27
  response = @connection.get(url)
28
28
 
29
29
  RequestResult.new(status: response.status, result: response.body)
@@ -31,9 +31,9 @@ class UffizziCore::DockerRegistryClient
31
31
 
32
32
  private
33
33
 
34
- def build_connection(registry_url, username, password)
35
- connection = Faraday.new(registry_url) do |faraday|
36
- faraday.headers['Accept'] = ACCEPTED_TYPES
34
+ def build_connection(username, password)
35
+ # initializing Faraday with the registry_url will trim the trailing slash required for the /v2/ request
36
+ connection = Faraday.new do |faraday|
37
37
  faraday.request(:basic_auth, username, password) if username.present? && password.present?
38
38
  faraday.request(:json)
39
39
  faraday.response(:json)
@@ -19,7 +19,7 @@ class UffizziCore::Api::Cli::V1::ComposeFile::CheckCredentialsForm
19
19
 
20
20
  containers = compose_data[:containers]
21
21
  containers.each do |container|
22
- container_registry_service = UffizziCore::ContainerRegistryService.init_by_container(container)
22
+ container_registry_service = UffizziCore::ContainerRegistryService.init_by_container(container, credentials)
23
23
  @type = container_registry_service.type
24
24
  next if container_registry_service.image_available?(credentials)
25
25
 
@@ -24,25 +24,6 @@ module UffizziCore::Concerns::Models::Account
24
24
  has_many :deployments, through: :projects
25
25
  has_many :payments, dependent: :destroy
26
26
 
27
- aasm(:state) do
28
- state :active, initial: true
29
- state :payment_issue
30
- state :disabled
31
- state :draft
32
-
33
- event :activate do
34
- transitions from: [:payment_issue, :disabled, :draft], to: :active
35
- end
36
-
37
- event :raise_payment_issue, before_success: :update_payment_issue_date do
38
- transitions from: [:active, :disabled], to: :payment_issue
39
- end
40
-
41
- event :disable, after: :disable_projects do
42
- transitions from: [:active, :payment_issue], to: :disabled
43
- end
44
- end
45
-
46
27
  aasm(:sso_state) do
47
28
  state :connection_not_configured, initial: true
48
29
  state :connection_disabled
@@ -27,7 +27,7 @@ module UffizziCore::Concerns::Models::Deployment
27
27
  validates :kind, presence: true
28
28
 
29
29
  enumerize :creation_source, in: [:manual, :demo, :continuous_preview, :compose_file_manual, :compose_file_continuous_preview,
30
- :github_actions], predicates: true, scope: true, default: :manual
30
+ :github_actions, :gitlab_actions], predicates: true, scope: true, default: :manual
31
31
 
32
32
  accepts_nested_attributes_for :containers, allow_destroy: true
33
33
 
@@ -4,4 +4,23 @@ class UffizziCore::Account < UffizziCore::ApplicationRecord
4
4
  include UffizziCore::Concerns::Models::Account
5
5
 
6
6
  belongs_to :owner, class_name: UffizziCore::User.name, foreign_key: :owner_id
7
+
8
+ aasm(:state) do
9
+ state :active, initial: true
10
+ state :payment_issue
11
+ state :disabled
12
+ state :draft
13
+
14
+ event :activate do
15
+ transitions from: [:payment_issue, :disabled, :draft], to: :active
16
+ end
17
+
18
+ event :raise_payment_issue, before_success: :update_payment_issue_date do
19
+ transitions from: [:active, :disabled], to: :payment_issue
20
+ end
21
+
22
+ event :disable, after: :disable_projects do
23
+ transitions from: [:active, :payment_issue], to: :disabled
24
+ end
25
+ end
7
26
  end
@@ -59,7 +59,7 @@ class UffizziCore::ComposeFile::Builders::ContainerBuilderService
59
59
  private
60
60
 
61
61
  def container_registry(container_data)
62
- @container_registry ||= UffizziCore::ContainerRegistryService.init_by_container(container_data)
62
+ @container_registry ||= UffizziCore::ContainerRegistryService.init_by_container(container_data, @credentials)
63
63
  end
64
64
 
65
65
  def repo_attributes(container_data, continuous_preview_global_data)
@@ -9,17 +9,23 @@ class UffizziCore::ContainerRegistryService
9
9
  new(type.to_sym)
10
10
  end
11
11
 
12
- def init_by_container(container)
12
+ def init_by_container(container, credentials)
13
13
  registry_url = container.dig(:image, :registry_url)
14
14
 
15
15
  return new(:docker_hub, container) if registry_url.include?('docker.io')
16
16
  return new(:azure, container) if registry_url.include?('azurecr.io')
17
17
  return new(:google, container) if registry_url.include?('gcr.io')
18
- return new(:amazon, container) if registry_url.include?('amazonaws.com')
18
+ return init_by_credentials(container, credentials) if registry_url.include?('amazonaws.com')
19
19
  return new(:github_container_registry, container) if registry_url.include?('ghcr.io')
20
20
  return new(:docker_registry, container) if docker_registry?(container)
21
21
  end
22
22
 
23
+ def init_by_credentials(container, credentials)
24
+ return new(:docker_registry, container) if credentials && credentials.docker_registry.where(username: 'AWS').exists?
25
+
26
+ new(:amazon, container)
27
+ end
28
+
23
29
  def docker_registry?(container)
24
30
  registry_url = container.dig(:image, :registry_url)
25
31
  return false if registry_url.nil?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.1.25'
4
+ VERSION = '2.1.27'
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.25
4
+ version: 2.1.27
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-05-31 00:00:00.000000000 Z
12
+ date: 2023-06-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -876,7 +876,6 @@ files:
876
876
  - app/models/uffizzi_core/credential/azure.rb
877
877
  - app/models/uffizzi_core/credential/docker_hub.rb
878
878
  - app/models/uffizzi_core/credential/docker_registry.rb
879
- - app/models/uffizzi_core/credential/github.rb
880
879
  - app/models/uffizzi_core/credential/github_container_registry.rb
881
880
  - app/models/uffizzi_core/credential/google.rb
882
881
  - app/models/uffizzi_core/database.rb
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class UffizziCore::Credential::Github < UffizziCore::Credential
4
- end