uffizzi_core 2.0.7 → 2.0.9
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 +4 -4
- data/app/clients/uffizzi_core/controller_client.rb +2 -2
- data/app/controllers/uffizzi_core/api/cli/v1/projects/deployments/containers/logs_controller.rb +1 -1
- data/app/controllers/uffizzi_core/application_controller.rb +5 -3
- data/app/errors/uffizzi_core/registry_not_supported_error.rb +4 -0
- data/app/forms/uffizzi_core/api/cli/v1/account/credential/create_form.rb +1 -1
- data/app/forms/uffizzi_core/api/cli/v1/account/credential/update_form.rb +1 -1
- data/app/forms/uffizzi_core/api/cli/v1/compose_file/check_credentials_form.rb +8 -1
- data/app/forms/uffizzi_core/api/cli/v1/compose_file/template_form.rb +2 -0
- data/app/forms/uffizzi_core/api/cli/v1/template/create_form.rb +2 -55
- data/app/lib/uffizzi_core/concerns/models/credential.rb +22 -17
- data/app/lib/uffizzi_core/concerns/models/event.rb +2 -2
- data/app/lib/uffizzi_core/concerns/models/repo.rb +0 -1
- data/app/lib/uffizzi_core/concerns/models/template.rb +16 -0
- data/app/models/uffizzi_core/credential.rb +3 -0
- data/app/serializers/uffizzi_core/api/cli/v1/projects/deployment_serializer.rb +0 -5
- data/app/serializers/uffizzi_core/api/cli/v1/projects/deployments/container_serializer.rb +1 -9
- data/app/serializers/uffizzi_core/controller/create_credential/credential_serializer.rb +1 -1
- data/app/services/uffizzi_core/activity_item_service.rb +2 -11
- data/app/services/uffizzi_core/compose_file/builders/container_builder_service.rb +33 -82
- data/app/services/uffizzi_core/compose_file/container_service.rb +0 -72
- data/app/services/uffizzi_core/compose_file_service.rb +6 -28
- data/app/services/uffizzi_core/{amazon/credential_service.rb → container_registry/amazon_service.rb} +20 -2
- data/app/services/uffizzi_core/container_registry/azure_service.rb +21 -0
- data/app/services/uffizzi_core/{docker_hub_service.rb → container_registry/docker_hub_service.rb} +7 -3
- data/app/services/uffizzi_core/{docker_registry_service.rb → container_registry/docker_registry_service.rb} +15 -1
- data/app/services/uffizzi_core/{github_container_registry/credential_service.rb → container_registry/github_container_registry_service.rb} +7 -4
- data/app/services/uffizzi_core/container_registry/google_service.rb +27 -0
- data/app/services/uffizzi_core/container_registry_service.rb +91 -0
- data/app/services/uffizzi_core/logs_service.rb +1 -0
- data/app/services/uffizzi_core/manage_activity_items_service.rb +2 -13
- data/app/services/uffizzi_core/repo_service.rb +2 -19
- data/config/locales/en.activerecord.yml +1 -1
- data/config/locales/en.yml +9 -0
- data/lib/uffizzi_core/version.rb +1 -1
- metadata +10 -17
- data/app/lib/uffizzi_core/concerns/models/build.rb +0 -47
- data/app/models/uffizzi_core/build.rb +0 -5
- data/app/repositories/uffizzi_core/build_repo.rb +0 -23
- data/app/services/uffizzi_core/amazon_service.rb +0 -31
- data/app/services/uffizzi_core/azure/credential_service.rb +0 -18
- data/app/services/uffizzi_core/credential_service.rb +0 -45
- data/app/services/uffizzi_core/docker_hub/credential_service.rb +0 -15
- data/app/services/uffizzi_core/docker_registry/credential_service.rb +0 -21
- data/app/services/uffizzi_core/google/credential_service.rb +0 -18
- data/app/services/uffizzi_core/google_service.rb +0 -21
- data/app/services/uffizzi_core/template_service.rb +0 -21
@@ -59,19 +59,6 @@ class UffizziCore::ComposeFileService
|
|
59
59
|
builder.build_attributes(compose_data, compose_dependencies, source)
|
60
60
|
end
|
61
61
|
|
62
|
-
def containers_credentials(compose_data, credentials)
|
63
|
-
containers = compose_data[:containers]
|
64
|
-
detected_credentials = containers.map do |container|
|
65
|
-
UffizziCore::ComposeFile::ContainerService.credential_for_container(container, credentials)
|
66
|
-
end
|
67
|
-
|
68
|
-
result = []
|
69
|
-
detected_credentials.compact
|
70
|
-
.group_by { |credential| credential[:id] }
|
71
|
-
.each_pair { |_id, value| result << value.first }
|
72
|
-
result
|
73
|
-
end
|
74
|
-
|
75
62
|
def has_secret?(compose_file, secret)
|
76
63
|
containers = compose_file.template.payload['containers_attributes']
|
77
64
|
|
@@ -91,8 +78,7 @@ class UffizziCore::ComposeFileService
|
|
91
78
|
|
92
79
|
if new_secrets_errors.present?
|
93
80
|
new_errors = { UffizziCore::ComposeFile::ErrorsService::SECRETS_ERROR_KEY => new_secrets_errors }
|
94
|
-
UffizziCore::ComposeFile::ErrorsService.update_compose_errors!(compose_file,
|
95
|
-
compose_file_errors.merge(new_errors),
|
81
|
+
UffizziCore::ComposeFile::ErrorsService.update_compose_errors!(compose_file, compose_file_errors.merge(new_errors),
|
96
82
|
compose_file.content)
|
97
83
|
next
|
98
84
|
end
|
@@ -117,12 +103,8 @@ class UffizziCore::ComposeFileService
|
|
117
103
|
end
|
118
104
|
|
119
105
|
def create_temporary_compose(resource_project, current_user, compose_file_params, dependencies)
|
120
|
-
create_params = {
|
121
|
-
|
122
|
-
user: current_user,
|
123
|
-
compose_file_params: compose_file_params,
|
124
|
-
dependencies: dependencies || [],
|
125
|
-
}
|
106
|
+
create_params = { project: resource_project, user: current_user, compose_file_params: compose_file_params,
|
107
|
+
dependencies: dependencies || [] }
|
126
108
|
kind = UffizziCore::ComposeFile.kind.temporary
|
127
109
|
UffizziCore::ComposeFileService.create(create_params, kind)
|
128
110
|
end
|
@@ -173,11 +155,7 @@ class UffizziCore::ComposeFileService
|
|
173
155
|
end
|
174
156
|
|
175
157
|
def prepare_compose_file_dependencies(compose_dependencies)
|
176
|
-
compose_dependencies.map
|
177
|
-
{
|
178
|
-
path: dependency[:path],
|
179
|
-
}
|
180
|
-
end
|
158
|
+
compose_dependencies.map { |dependency| { path: dependency[:path] } }
|
181
159
|
end
|
182
160
|
|
183
161
|
def persist!(compose_file_form, cli_form)
|
@@ -201,6 +179,7 @@ class UffizziCore::ComposeFileService
|
|
201
179
|
|
202
180
|
raise ActiveRecord::Rollback if errors.present?
|
203
181
|
end
|
182
|
+
|
204
183
|
[compose_file_form, errors]
|
205
184
|
end
|
206
185
|
|
@@ -208,9 +187,8 @@ class UffizziCore::ComposeFileService
|
|
208
187
|
begin
|
209
188
|
compose_data = YAML.safe_load(compose_content, aliases: true)
|
210
189
|
rescue Psych::SyntaxError
|
211
|
-
raise UffizziCore::ComposeFile::ParseError, '
|
190
|
+
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.invalid_file')
|
212
191
|
end
|
213
|
-
|
214
192
|
raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.unsupported_file') if compose_data.nil?
|
215
193
|
|
216
194
|
compose_data
|
data/app/services/uffizzi_core/{amazon/credential_service.rb → container_registry/amazon_service.rb}
RENAMED
@@ -1,7 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class UffizziCore::
|
3
|
+
class UffizziCore::ContainerRegistry::AmazonService
|
4
4
|
class << self
|
5
|
+
def digest(credential, image, tag)
|
6
|
+
response = client(credential).batch_get_image(image: image, tag: tag)
|
7
|
+
response.images[0].image_id.image_digest
|
8
|
+
rescue StandardError
|
9
|
+
nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_region_from_registry_url(url)
|
13
|
+
parsed_url = URI.parse(url)
|
14
|
+
host = parsed_url.host
|
15
|
+
parsed_host = host.split('.')
|
16
|
+
parsed_host[3]
|
17
|
+
end
|
18
|
+
|
19
|
+
def image_available?(credential, _image_data)
|
20
|
+
credential.present?
|
21
|
+
end
|
22
|
+
|
5
23
|
def credential_correct?(credential)
|
6
24
|
access_token(credential).present?
|
7
25
|
end
|
@@ -19,7 +37,7 @@ class UffizziCore::Amazon::CredentialService
|
|
19
37
|
private
|
20
38
|
|
21
39
|
def client(credential)
|
22
|
-
region =
|
40
|
+
region = get_region_from_registry_url(credential.registry_url)
|
23
41
|
|
24
42
|
UffizziCore::AmazonRegistryClient.new(
|
25
43
|
region: region,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UffizziCore::ContainerRegistry::AzureService
|
4
|
+
class << self
|
5
|
+
def image_available?(credential, _image_data)
|
6
|
+
credential.present?
|
7
|
+
end
|
8
|
+
|
9
|
+
def credential_correct?(credential)
|
10
|
+
client(credential).authentificated?
|
11
|
+
rescue URI::InvalidURIError, Faraday::ConnectionFailed
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def client(c)
|
18
|
+
UffizziCore::AzureRegistryClient.new(registry_url: c.registry_url, username: c.username, password: c.password)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/app/services/uffizzi_core/{docker_hub_service.rb → container_registry/docker_hub_service.rb}
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class UffizziCore::DockerHubService
|
3
|
+
class UffizziCore::ContainerRegistry::DockerHubService
|
4
4
|
class << self
|
5
5
|
def accounts(credential)
|
6
6
|
client = user_client(credential)
|
@@ -41,10 +41,14 @@ class UffizziCore::DockerHubService
|
|
41
41
|
response.headers['docker-content-digest']
|
42
42
|
end
|
43
43
|
|
44
|
+
def credential_correct?(credential)
|
45
|
+
client(credential).authentificated?
|
46
|
+
end
|
47
|
+
|
44
48
|
private
|
45
49
|
|
46
|
-
def
|
47
|
-
|
50
|
+
def client(credential)
|
51
|
+
UffizziCore::DockerHubClient.new(credential)
|
48
52
|
end
|
49
53
|
|
50
54
|
def not_found?(response)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class UffizziCore::DockerRegistryService
|
3
|
+
class UffizziCore::ContainerRegistry::DockerRegistryService
|
4
4
|
class << self
|
5
5
|
def image_available?(credential, image_data)
|
6
6
|
client_params = build_client_params(credential, image_data)
|
@@ -10,8 +10,22 @@ class UffizziCore::DockerRegistryService
|
|
10
10
|
response.status < 400
|
11
11
|
end
|
12
12
|
|
13
|
+
def credential_correct?(credential)
|
14
|
+
client(credential).authenticated?
|
15
|
+
end
|
16
|
+
|
13
17
|
private
|
14
18
|
|
19
|
+
def client(credential)
|
20
|
+
params = {
|
21
|
+
registry_url: credential.registry_url,
|
22
|
+
username: credential.username,
|
23
|
+
password: credential.password,
|
24
|
+
}
|
25
|
+
|
26
|
+
UffizziCore::DockerRegistryClient.new(params)
|
27
|
+
end
|
28
|
+
|
15
29
|
def build_client_params(credential, image_data)
|
16
30
|
registry_url = credential&.registry_url || image_data[:registry_url]
|
17
31
|
new_registry_url = registry_url.start_with?('https://', 'http://') ? registry_url : "https://#{registry_url}"
|
@@ -1,7 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class UffizziCore::
|
3
|
+
class UffizziCore::ContainerRegistry::GithubContainerRegistryService
|
4
4
|
class << self
|
5
|
+
def image_available?(credential, _image_data)
|
6
|
+
credential.present?
|
7
|
+
end
|
8
|
+
|
5
9
|
def credential_correct?(credential)
|
6
10
|
client(credential).authentificated?
|
7
11
|
rescue URI::InvalidURIError, Faraday::ConnectionFailed
|
@@ -16,9 +20,8 @@ class UffizziCore::GithubContainerRegistry::CredentialService
|
|
16
20
|
|
17
21
|
private
|
18
22
|
|
19
|
-
def client(
|
20
|
-
UffizziCore::GithubContainerRegistryClient.new(registry_url:
|
21
|
-
password: credential.password)
|
23
|
+
def client(c)
|
24
|
+
UffizziCore::GithubContainerRegistryClient.new(registry_url: c.registry_url, username: c.username, password: c.password)
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UffizziCore::ContainerRegistry::GoogleService
|
4
|
+
class << self
|
5
|
+
def digest(credential, image, tag)
|
6
|
+
response = client(credential).manifests(image: image, tag: tag)
|
7
|
+
|
8
|
+
response.headers['docker-content-digest']
|
9
|
+
end
|
10
|
+
|
11
|
+
def image_available?(credential, _image_data)
|
12
|
+
credential.present?
|
13
|
+
end
|
14
|
+
|
15
|
+
def credential_correct?(credential)
|
16
|
+
client(credential).authentificated?
|
17
|
+
rescue URI::InvalidURIError, Faraday::ConnectionFailed
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def client(c)
|
24
|
+
UffizziCore::GoogleRegistryClient.new(registry_url: c.registry_url, username: c.username, password: c.password)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UffizziCore::ContainerRegistryService
|
4
|
+
attr_accessor :type, :container_data
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def init_by_subclass(credential_type)
|
8
|
+
type = credential_type.demodulize.underscore
|
9
|
+
new(type.to_sym)
|
10
|
+
end
|
11
|
+
|
12
|
+
def init_by_container(container)
|
13
|
+
registry_url = container.dig(:image, :registry_url)
|
14
|
+
repository_url = container.dig(:build, :repository_url)
|
15
|
+
|
16
|
+
return new(:docker_hub, container) if registry_url.blank? && repository_url.blank?
|
17
|
+
return new(:azure, container) if registry_url.include?('azurecr.io')
|
18
|
+
return new(:google, container) if registry_url.include?('gcr.io')
|
19
|
+
return new(:amazon, container) if registry_url.include?('amazonaws.com')
|
20
|
+
return new(:github_container_registry, container) if registry_url.include?('ghcr.io')
|
21
|
+
return new(:docker_registry, container) if docker_registry?(container)
|
22
|
+
end
|
23
|
+
|
24
|
+
def docker_registry?(container)
|
25
|
+
registry_url = container.dig(:image, :registry_url)
|
26
|
+
return false if registry_url.nil?
|
27
|
+
|
28
|
+
registry_domain_regexp = /(\w+\.\w{2,})(?::\d+)?\z/
|
29
|
+
registry_domain = registry_url.match(registry_domain_regexp)&.to_a&.last
|
30
|
+
return false if registry_domain.nil?
|
31
|
+
|
32
|
+
['amazonaws.com', 'azurecr.io', 'gcr.io', 'ghcr.io'].exclude?(registry_domain)
|
33
|
+
end
|
34
|
+
|
35
|
+
def sources
|
36
|
+
[:azure, :google, :amazon, :github_container_registry, :docker_registry, :docker_hub, *additional_sources]
|
37
|
+
end
|
38
|
+
|
39
|
+
def additional_sources
|
40
|
+
[]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize(type, container_data = {})
|
45
|
+
@type = type
|
46
|
+
@container_data = container_data
|
47
|
+
|
48
|
+
raise ::UffizziCore::RegistryNotSupportedError unless self.class.sources.include?(type)
|
49
|
+
end
|
50
|
+
|
51
|
+
def digest(credential, image, tag)
|
52
|
+
service.digest(credential, image, tag)
|
53
|
+
end
|
54
|
+
|
55
|
+
def service
|
56
|
+
@service ||= "UffizziCore::ContainerRegistry::#{type.to_s.camelize}Service".safe_constantize
|
57
|
+
end
|
58
|
+
|
59
|
+
def repo_type
|
60
|
+
@repo_type ||= "UffizziCore::Repo::#{type.to_s.camelize}".safe_constantize
|
61
|
+
end
|
62
|
+
|
63
|
+
def credential_correct?(credential)
|
64
|
+
service.credential_correct?(credential)
|
65
|
+
end
|
66
|
+
|
67
|
+
def image_data
|
68
|
+
@image_data ||= container_data[:image]
|
69
|
+
end
|
70
|
+
|
71
|
+
def image_name(credentials)
|
72
|
+
if image_data[:registry_url].present? && [:google, :github_container_registry, :docker_registry].exclude?(type)
|
73
|
+
return image_data[:name]
|
74
|
+
end
|
75
|
+
|
76
|
+
if type == :docker_registry && credential(credentials).nil?
|
77
|
+
return [image_data[:registry_url], image_data[:namespace], image_data[:name]].compact.join('/')
|
78
|
+
end
|
79
|
+
|
80
|
+
"#{image_data[:namespace]}/#{image_data[:name]}"
|
81
|
+
end
|
82
|
+
|
83
|
+
def credential(credentials_scope)
|
84
|
+
credentials_scope.send(type).first
|
85
|
+
end
|
86
|
+
|
87
|
+
def image_available?(credentials_scope)
|
88
|
+
credential = credential(credentials_scope)
|
89
|
+
service.image_available?(credential, image_data)
|
90
|
+
end
|
91
|
+
end
|
@@ -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
|
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
|
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
|
@@ -9,22 +9,9 @@ class UffizziCore::RepoService
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def credential(repo)
|
12
|
+
container_registry_service = UffizziCore::ContainerRegistryService.init_by_subclass(repo.type)
|
12
13
|
credentials = repo.project.account.credentials
|
13
|
-
|
14
|
-
case repo.type
|
15
|
-
when UffizziCore::Repo::GithubContainerRegistry.name
|
16
|
-
credentials.github_container_registry.first
|
17
|
-
when UffizziCore::Repo::DockerHub.name
|
18
|
-
credentials.docker_hub.first
|
19
|
-
when UffizziCore::Repo::DockerRegistry.name
|
20
|
-
credentials.docker_registry.first
|
21
|
-
when UffizziCore::Repo::Azure.name
|
22
|
-
credentials.azure.first
|
23
|
-
when UffizziCore::Repo::Google.name
|
24
|
-
credentials.google.first
|
25
|
-
when UffizziCore::Repo::Amazon.name
|
26
|
-
credentials.amazon.first
|
27
|
-
end
|
14
|
+
container_registry_service.credential(credentials)
|
28
15
|
end
|
29
16
|
|
30
17
|
def image_name(repo)
|
@@ -32,10 +19,6 @@ class UffizziCore::RepoService
|
|
32
19
|
#{repo.project_id}:#{repo.id}")[0, 10]}"
|
33
20
|
end
|
34
21
|
|
35
|
-
def tag(repo)
|
36
|
-
repo&.builds&.deployed&.last&.commit || 'latest'
|
37
|
-
end
|
38
|
-
|
39
22
|
def image(repo)
|
40
23
|
repo_credential = credential(repo)
|
41
24
|
|
@@ -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
|
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:
|
data/config/locales/en.yml
CHANGED
@@ -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"
|
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.0.
|
4
|
+
version: 2.0.9
|
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-
|
12
|
+
date: 2022-11-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aasm
|
@@ -776,6 +776,7 @@ files:
|
|
776
776
|
- app/errors/uffizzi_core/deployment/image_pull_error.rb
|
777
777
|
- app/errors/uffizzi_core/deployment/labels_not_found_error.rb
|
778
778
|
- app/errors/uffizzi_core/deployment_not_found_error.rb
|
779
|
+
- app/errors/uffizzi_core/registry_not_supported_error.rb
|
779
780
|
- app/forms/uffizzi_core/api/cli/v1/account/credential/check_credential_form.rb
|
780
781
|
- app/forms/uffizzi_core/api/cli/v1/account/credential/create_form.rb
|
781
782
|
- app/forms/uffizzi_core/api/cli/v1/account/credential/update_form.rb
|
@@ -811,7 +812,6 @@ files:
|
|
811
812
|
- app/jobs/uffizzi_core/deployment/update_credential_job.rb
|
812
813
|
- app/lib/uffizzi_core/concerns/models/account.rb
|
813
814
|
- app/lib/uffizzi_core/concerns/models/activity_item.rb
|
814
|
-
- app/lib/uffizzi_core/concerns/models/build.rb
|
815
815
|
- app/lib/uffizzi_core/concerns/models/comment.rb
|
816
816
|
- app/lib/uffizzi_core/concerns/models/compose_file.rb
|
817
817
|
- app/lib/uffizzi_core/concerns/models/config_file.rb
|
@@ -845,7 +845,6 @@ files:
|
|
845
845
|
- app/models/uffizzi_core/activity_item/github.rb
|
846
846
|
- app/models/uffizzi_core/activity_item/memory_limit.rb
|
847
847
|
- app/models/uffizzi_core/application_record.rb
|
848
|
-
- app/models/uffizzi_core/build.rb
|
849
848
|
- app/models/uffizzi_core/comment.rb
|
850
849
|
- app/models/uffizzi_core/compose_file.rb
|
851
850
|
- app/models/uffizzi_core/config_file.rb
|
@@ -898,7 +897,6 @@ files:
|
|
898
897
|
- app/repositories/uffizzi_core/account_repo.rb
|
899
898
|
- app/repositories/uffizzi_core/activity_item_repo.rb
|
900
899
|
- app/repositories/uffizzi_core/basic_order_repo.rb
|
901
|
-
- app/repositories/uffizzi_core/build_repo.rb
|
902
900
|
- app/repositories/uffizzi_core/comment_repo.rb
|
903
901
|
- app/repositories/uffizzi_core/compose_file_repo.rb
|
904
902
|
- app/repositories/uffizzi_core/config_file_repo.rb
|
@@ -949,9 +947,6 @@ files:
|
|
949
947
|
- app/serializers/uffizzi_core/controller/deploy_containers/host_volume_file_serializer.rb
|
950
948
|
- app/services/uffizzi_core/account_service.rb
|
951
949
|
- app/services/uffizzi_core/activity_item_service.rb
|
952
|
-
- app/services/uffizzi_core/amazon/credential_service.rb
|
953
|
-
- app/services/uffizzi_core/amazon_service.rb
|
954
|
-
- app/services/uffizzi_core/azure/credential_service.rb
|
955
950
|
- app/services/uffizzi_core/compose_file/builders/container_builder_service.rb
|
956
951
|
- app/services/uffizzi_core/compose_file/builders/container_config_files_builder_service.rb
|
957
952
|
- app/services/uffizzi_core/compose_file/builders/container_host_volume_files_builder_service.rb
|
@@ -984,23 +979,21 @@ files:
|
|
984
979
|
- app/services/uffizzi_core/compose_file/parsers/variables_parser_service.rb
|
985
980
|
- app/services/uffizzi_core/compose_file/template_service.rb
|
986
981
|
- app/services/uffizzi_core/compose_file_service.rb
|
982
|
+
- app/services/uffizzi_core/container_registry/amazon_service.rb
|
983
|
+
- app/services/uffizzi_core/container_registry/azure_service.rb
|
984
|
+
- app/services/uffizzi_core/container_registry/docker_hub_service.rb
|
985
|
+
- app/services/uffizzi_core/container_registry/docker_registry_service.rb
|
986
|
+
- app/services/uffizzi_core/container_registry/github_container_registry_service.rb
|
987
|
+
- app/services/uffizzi_core/container_registry/google_service.rb
|
988
|
+
- app/services/uffizzi_core/container_registry_service.rb
|
987
989
|
- app/services/uffizzi_core/container_service.rb
|
988
990
|
- app/services/uffizzi_core/controller_service.rb
|
989
|
-
- app/services/uffizzi_core/credential_service.rb
|
990
991
|
- app/services/uffizzi_core/deployment_service.rb
|
991
|
-
- app/services/uffizzi_core/docker_hub/credential_service.rb
|
992
|
-
- app/services/uffizzi_core/docker_hub_service.rb
|
993
|
-
- app/services/uffizzi_core/docker_registry/credential_service.rb
|
994
|
-
- app/services/uffizzi_core/docker_registry_service.rb
|
995
|
-
- app/services/uffizzi_core/github_container_registry/credential_service.rb
|
996
|
-
- app/services/uffizzi_core/google/credential_service.rb
|
997
|
-
- app/services/uffizzi_core/google_service.rb
|
998
992
|
- app/services/uffizzi_core/logs_service.rb
|
999
993
|
- app/services/uffizzi_core/manage_activity_items_service.rb
|
1000
994
|
- app/services/uffizzi_core/project_service.rb
|
1001
995
|
- app/services/uffizzi_core/repo_service.rb
|
1002
996
|
- app/services/uffizzi_core/response_service.rb
|
1003
|
-
- app/services/uffizzi_core/template_service.rb
|
1004
997
|
- app/services/uffizzi_core/token_service.rb
|
1005
998
|
- app/services/uffizzi_core/user_access_service.rb
|
1006
999
|
- app/services/uffizzi_core/user_generator_service.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,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
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::AmazonService
|
4
|
-
class << self
|
5
|
-
def digest(credential, image, tag)
|
6
|
-
response = client(credential).batch_get_image(image: image, tag: tag)
|
7
|
-
response.images[0].image_id.image_digest
|
8
|
-
rescue StandardError
|
9
|
-
nil
|
10
|
-
end
|
11
|
-
|
12
|
-
def get_region_from_registry_url(url)
|
13
|
-
parsed_url = URI.parse(url)
|
14
|
-
host = parsed_url.host
|
15
|
-
parsed_host = host.split('.')
|
16
|
-
parsed_host[3]
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def client(credential)
|
22
|
-
region = get_region_from_registry_url(credential.registry_url)
|
23
|
-
|
24
|
-
UffizziCore::AmazonRegistryClient.new(
|
25
|
-
region: region,
|
26
|
-
access_key_id: credential.username,
|
27
|
-
secret_access_key: credential.password,
|
28
|
-
)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::Azure::CredentialService
|
4
|
-
class << self
|
5
|
-
def credential_correct?(credential)
|
6
|
-
client(credential).authentificated?
|
7
|
-
rescue URI::InvalidURIError, Faraday::ConnectionFailed
|
8
|
-
false
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def client(credential)
|
14
|
-
UffizziCore::AzureRegistryClient.new(registry_url: credential.registry_url, username: credential.username,
|
15
|
-
password: credential.password)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|