uffizzi_core 0.3.0 → 0.3.3

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: 40e3a8b7bbd915a1e861fbc7cff0b188741c49be50aa02d8ee05e790e47038a3
4
- data.tar.gz: d02d1b3eba6bfbc471266dd28f23200a43cc88c71e7139c1d5bf43c915292f31
3
+ metadata.gz: '0995e3de000730f4d7d9efeeb62415e374f4d58569b31a60db5faffa99f58453'
4
+ data.tar.gz: 53ea793138e8229747e1462156a158e0c4114130c03c7a7eb7993d66e07f472f
5
5
  SHA512:
6
- metadata.gz: 4bff4a31ff842379bd0907336285b65f31052b58d55ecd104632d483304e07722b75d2591eba942c6583e99ea4f3d23c08765a42b1b102e478f031b5001c4ff4
7
- data.tar.gz: 7d0e59f416be2ed26806363b85efa090eb3b02a3ba34546cd5103467d0f80566ddcb7f34270250c8112e65e2c2e35f2ce8dd6fab22f7fb958207e89f72c749f9
6
+ metadata.gz: cdba3364a0821713bb040dc31192fcbac362aea072ae0865d5353576b0428ee7aeada4fcdd15733dfdef340e0c49bd9055f07752a712f7c0063d3dd4cc396c88
7
+ data.tar.gz: 3fec15634e8fc1e9de9eea24b2b913832633cba55065390ee22141f80a22290d31d50c30a9f998ff2d0cd90d023d45a0f3ad7fc0dd111d84d7235111e63c4882
@@ -13,6 +13,12 @@ module UffizziCore::DependencyInjectionConcern
13
13
  module_class(:github)
14
14
  end
15
15
 
16
+ def password_protection_module
17
+ return unless module_exists?(:password_protection)
18
+
19
+ module_class(:password_protection)
20
+ end
21
+
16
22
  private
17
23
 
18
24
  def module_exists?(module_name)
@@ -5,7 +5,7 @@ class UffizziCore::ConfigFile::ApplyJob < UffizziCore::ApplicationJob
5
5
 
6
6
  sidekiq_retry_in do |count, exception|
7
7
  case exception
8
- when UffizziCore::ControllerService::DeploymentNotFoundError
8
+ when UffizziCore::DeploymentNotFoundError
9
9
  Rails.logger.info("DEPLOYMENT_PROCESS ApplyJob retry deployment_id=#{exception.deployment_id} count=#{count}")
10
10
  Settings.controller.resource_create_retry_time
11
11
  end
@@ -22,7 +22,7 @@ class UffizziCore::ConfigFile::ApplyJob < UffizziCore::ApplicationJob
22
22
  end
23
23
 
24
24
  unless UffizziCore::ControllerService.deployment_exists?(deployment)
25
- raise UffizziCore::ControllerService::DeploymentNotFoundError,
25
+ raise UffizziCore::DeploymentNotFoundError,
26
26
  deployment_id
27
27
  end
28
28
 
@@ -57,6 +57,7 @@ module UffizziCore::Concerns::Models::Deployment
57
57
 
58
58
  def after_disable
59
59
  clean
60
+ update!(disabled_at: Time.now)
60
61
  end
61
62
 
62
63
  def after_fail
@@ -27,13 +27,11 @@ class UffizziCore::Controller::DeployContainers::ContainerSerializer < UffizziCo
27
27
  credential = UffizziCore::RepoService.credential(repo)
28
28
 
29
29
  case repo.type
30
- when UffizziCore::Repo::Google.name, UffizziCore::Repo::Amazon.name, UffizziCore::Repo::Azure.name
30
+ when UffizziCore::Repo::Google.name, UffizziCore::Repo::Amazon.name, UffizziCore::Repo::Azure.name,
31
+ UffizziCore::Repo::GithubContainerRegistry.name
31
32
  registry_host = URI.parse(credential.registry_url).host
32
33
 
33
34
  "#{registry_host}/#{object.image}"
34
- when UffizziCore::Repo::GithubContainerRegistry.name
35
- registry_host = URI.parse(credential.registry_url).host
36
- "#{registry_host}/#{repo.namespace}/#{object.image}"
37
35
  else
38
36
  object.image
39
37
  end
@@ -105,7 +105,9 @@ class UffizziCore::ComposeFile::Builders::ContainerBuilderService
105
105
  end
106
106
 
107
107
  def image_name(container_data, image_data)
108
- if image_data[:registry_url].present? && !UffizziCore::ComposeFile::ContainerService.google?(container_data)
108
+ if image_data[:registry_url].present? &&
109
+ !UffizziCore::ComposeFile::ContainerService.google?(container_data) &&
110
+ !UffizziCore::ComposeFile::ContainerService.github_container_registry?(container_data)
109
111
  image_data[:name]
110
112
  else
111
113
  "#{image_data[:namespace]}/#{image_data[:name]}"
@@ -2,6 +2,8 @@
2
2
 
3
3
  class UffizziCore::ControllerService
4
4
  class << self
5
+ include UffizziCore::DependencyInjectionConcern
6
+
5
7
  def apply_config_file(deployment, config_file)
6
8
  body = {
7
9
  config_file: UffizziCore::Controller::ApplyConfigFile::ConfigFileSerializer.new(config_file).as_json,
@@ -53,6 +55,10 @@ class UffizziCore::ControllerService
53
55
  deployment_url: UffizziCore::DeploymentService.build_preview_url(deployment),
54
56
  }
55
57
 
58
+ if password_protection_module.present?
59
+ body = password_protection_module.add_password_configuration(body, deployment.project_id)
60
+ end
61
+
56
62
  controller_client.deploy_containers(deployment_id: deployment.id, body: body)
57
63
  end
58
64
 
@@ -49,13 +49,13 @@ class UffizziCore::DockerHubService
49
49
  end
50
50
 
51
51
  def user_client(credential)
52
- if @client.nil?
53
- @client = UffizziCore::DockerHubClient.new(credential)
52
+ return @client if @client&.credential&.username == credential.username
54
53
 
55
- unless @client.authentificated?
56
- Rails.logger.warn("broken credentials, DockerHubService credential_id=#{credential.id}")
57
- credential.unauthorize! unless credential.unauthorized?
58
- end
54
+ @client = UffizziCore::DockerHubClient.new(credential)
55
+
56
+ unless @client.authentificated?
57
+ Rails.logger.warn("broken credentials, DockerHubService credential_id=#{credential.id}")
58
+ credential.unauthorize! unless credential.unauthorized?
59
59
  end
60
60
 
61
61
  @client
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDisabledAtToDeployments < ActiveRecord::Migration[6.1]
4
+ def up
5
+ change_table :uffizzi_core_deployments do |t|
6
+ t.datetime :disabled_at
7
+ end
8
+ UffizziCore::Deployment.disabled.update_all('disabled_at = updated_at')
9
+ end
10
+
11
+ def down
12
+ change_table :uffizzi_core_deployments do |t|
13
+ t.remove :disabled_at
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '0.3.0'
4
+ VERSION = '0.3.3'
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: 0.3.0
4
+ version: 0.3.3
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-07-07 00:00:00.000000000 Z
12
+ date: 2022-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -957,6 +957,7 @@ files:
957
957
  - db/migrate/20220419074956_add_health_check_to_containers.rb
958
958
  - db/migrate/20220422151523_add_volumes_to_uffizzi_core_containers.rb
959
959
  - db/migrate/20220525113412_rename_name_to_uffizzi_containers.rb
960
+ - db/migrate/20220704135629_add_disabled_at_to_deployments.rb
960
961
  - db/seeds.rb
961
962
  - lib/tasks/uffizzi_core_tasks.rake
962
963
  - lib/uffizzi_core.rb