uffizzi_core 2.1.26 → 2.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/clients/uffizzi_core/docker_registry_client.rb +6 -6
- data/app/forms/uffizzi_core/api/cli/v1/compose_file/check_credentials_form.rb +1 -1
- data/app/lib/uffizzi_core/concerns/models/account.rb +0 -19
- data/app/models/uffizzi_core/account.rb +19 -0
- data/app/services/uffizzi_core/compose_file/builders/container_builder_service.rb +1 -1
- data/app/services/uffizzi_core/container_registry_service.rb +8 -2
- data/lib/uffizzi_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a8a1183efec864646047c9f61ae530737b409a1053d35a784064f85644debc5
|
4
|
+
data.tar.gz: 1e379b56a9dbbd9359d9465d804e7006674033b2ce1ca044b100e180b7950804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
15
|
+
@connection = build_connection(username, password)
|
16
16
|
end
|
17
17
|
|
18
18
|
def authenticated?
|
19
|
-
@connection.
|
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(
|
35
|
-
|
36
|
-
|
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
|
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?
|
data/lib/uffizzi_core/version.rb
CHANGED
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.
|
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-
|
12
|
+
date: 2023-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|