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
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::CredentialService
|
4
|
-
class << self
|
5
|
-
def correct_credentials?(credential)
|
6
|
-
status = case credential.type
|
7
|
-
when UffizziCore::Credential::DockerHub.name
|
8
|
-
UffizziCore::DockerHub::CredentialService.credential_correct?(credential)
|
9
|
-
when UffizziCore::Credential::DockerRegistry.name
|
10
|
-
UffizziCore::DockerRegistry::CredentialService.credential_correct?(credential)
|
11
|
-
when UffizziCore::Credential::GithubContainerRegistry.name
|
12
|
-
UffizziCore::GithubContainerRegistry::CredentialService.credential_correct?(credential)
|
13
|
-
when UffizziCore::Credential::Azure.name
|
14
|
-
UffizziCore::Azure::CredentialService.credential_correct?(credential)
|
15
|
-
when UffizziCore::Credential::Google.name
|
16
|
-
UffizziCore::Google::CredentialService.credential_correct?(credential)
|
17
|
-
when UffizziCore::Credential::Amazon.name
|
18
|
-
UffizziCore::Amazon::CredentialService.credential_correct?(credential)
|
19
|
-
else
|
20
|
-
false
|
21
|
-
end
|
22
|
-
|
23
|
-
if credential.persisted? && credential.active? && !status
|
24
|
-
Rails.logger.warn("Wrong credential: credential_correct? credential_id=#{credential.id}")
|
25
|
-
end
|
26
|
-
|
27
|
-
status
|
28
|
-
end
|
29
|
-
|
30
|
-
def update_expired_credentials
|
31
|
-
currect_date = DateTime.now
|
32
|
-
credentials = UffizziCore::Credential::Amazon.active.where('updated_at < ?', currect_date - 10.hours)
|
33
|
-
|
34
|
-
credentials.each do |credential|
|
35
|
-
deployments = UffizziCore::Deployment.where(project_id: credential.account.projects.select(:id)).with_amazon_repos
|
36
|
-
|
37
|
-
deployments.each do |deployment|
|
38
|
-
UffizziCore::Deployment::CreateCredentialJob.perform_async(deployment.id, credential.id)
|
39
|
-
end
|
40
|
-
|
41
|
-
credential.update(updated_at: currect_date)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::DockerHub::CredentialService
|
4
|
-
class << self
|
5
|
-
def credential_correct?(credential)
|
6
|
-
client(credential).authentificated?
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def client(credential)
|
12
|
-
UffizziCore::DockerHubClient.new(credential)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::DockerRegistry::CredentialService
|
4
|
-
class << self
|
5
|
-
def credential_correct?(credential)
|
6
|
-
client(credential).authenticated?
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def client(credential)
|
12
|
-
params = {
|
13
|
-
registry_url: credential.registry_url,
|
14
|
-
username: credential.username,
|
15
|
-
password: credential.password,
|
16
|
-
}
|
17
|
-
|
18
|
-
UffizziCore::DockerRegistryClient.new(params)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::Google::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::GoogleRegistryClient.new(registry_url: credential.registry_url, username: credential.username,
|
15
|
-
password: credential.password)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::GoogleService
|
4
|
-
class << self
|
5
|
-
def digest(credential, image, tag)
|
6
|
-
response = registry_client(credential).manifests(image: image, tag: tag)
|
7
|
-
|
8
|
-
response.headers['docker-content-digest']
|
9
|
-
end
|
10
|
-
|
11
|
-
private
|
12
|
-
|
13
|
-
def registry_client(credential)
|
14
|
-
UffizziCore::GoogleRegistryClient.new(
|
15
|
-
registry_url: credential.registry_url,
|
16
|
-
username: credential.username,
|
17
|
-
password: credential.password,
|
18
|
-
)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
class UffizziCore::TemplateService
|
4
|
-
class << self
|
5
|
-
def valid_containers_memory_limit?(template)
|
6
|
-
containers_attributes = template.payload['containers_attributes']
|
7
|
-
container_memory_limit = template.project.account.container_memory_limit
|
8
|
-
return true if container_memory_limit.nil?
|
9
|
-
|
10
|
-
containers_attributes.all? { |container| container['memory_limit'].to_i <= container_memory_limit }
|
11
|
-
end
|
12
|
-
|
13
|
-
def valid_containers_memory_request?(template)
|
14
|
-
containers_attributes = template.payload['containers_attributes']
|
15
|
-
container_memory_limit = template.project.account.container_memory_limit
|
16
|
-
return true if container_memory_limit.nil?
|
17
|
-
|
18
|
-
containers_attributes.all? { |container| container['memory_request'].to_i <= container_memory_limit }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|