uffizzi_core 2.1.26 → 2.1.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72d1fe1b0397a4e5b6a0b95c5b9ad9374eb9c3dfef94c235e434b29daf44a8ed
4
- data.tar.gz: cbb2423de1feebba8b114fbf2d76e38560426e6ca5006e0d14787571eb404e56
3
+ metadata.gz: 5a8a1183efec864646047c9f61ae530737b409a1053d35a784064f85644debc5
4
+ data.tar.gz: 1e379b56a9dbbd9359d9465d804e7006674033b2ce1ca044b100e180b7950804
5
5
  SHA512:
6
- metadata.gz: 80536080ab0b3f4e898d819cf1013e20db1cf4a1cdaa373463998cecac53648ecf4feb2f643de2a953f7afd921d0ffd4564b1989c05cdc5f5c1d640d33ecdbb1
7
- data.tar.gz: 30339f6896549337c7c8c5a1cb59b21e2bbc28c3db3016c1b79ec091db83e2a6cf47704af8a91655628cba2a622a4194b8e5b640bdede3bd3df6c1f13a4013d6
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
@@ -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.26'
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.26
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-06-05 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