uffizzi_core 2.0.1 → 2.0.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: a8dde4ab08b392e84558c16e4967250af65c53920c983b1736df5af3091bbdac
4
- data.tar.gz: c7267a556db1b7132881ec0d9424eef05ce8dbbdf3b255456aba42bf0c38836c
3
+ metadata.gz: 62fa420959689bef475db8e095621079cc7e96ae0b73decf0282a1d9bec5744e
4
+ data.tar.gz: 76c69a8e8bfa2c6265dd3bcc7ad065a34e6ac6b3cfe8cc22ac3afcba6d477d1e
5
5
  SHA512:
6
- metadata.gz: 27c1495b43f347282da5ac664db5485d4d4f5a751660ae502baa76b23990656546dcfb16f3221b48bf1d6f7f9fa8919d0b8e8a665e041cf05c446d95305ad82a
7
- data.tar.gz: 2a0b7ae8d5e85aa69bc1c93f8e9a9bf6658b19a33bec346ecf9296a8c7a8e8defa10b93be8ff381c296578a0b90d9be8c31b1b5d13fb7bc20b7f7a92c96ce53f
6
+ metadata.gz: 005451ab5a4349aec3311fddb5257d1513f7d7b1f381375a75c5739c0635aea5d463574d7d6fb20424af76cc6c49e1d9146848fec7235d1a7d3b5c8ab2de5635
7
+ data.tar.gz: f3ac1a20fdb378b4926438abd9b3814cdedecea4de75fb48bc88f8a7d5b3d076f24becfce10df9edc794f55f6457f76c652a7395606f6b31dd9b56af0b98fc9d
@@ -27,6 +27,10 @@ module UffizziCore::DependencyInjectionConcern
27
27
  module_class(:password_protection)
28
28
  end
29
29
 
30
+ def find_ingress_parser_module
31
+ module_class(:ingress_parser)
32
+ end
33
+
30
34
  private
31
35
 
32
36
  def module_exists?(module_name)
@@ -18,6 +18,7 @@ class UffizziCore::Api::Cli::V1::Deployment::CreateForm < UffizziCore::Deploymen
18
18
  :receive_incoming_requests,
19
19
  :continuously_deploy,
20
20
  { variables: [:name, :value],
21
+ additional_subdomains: [],
21
22
  secret_variables: [:name, :value],
22
23
  volumes: [:source, :target, :type, :read_only],
23
24
  healthcheck: [:test, :interval, :timeout, :retries, :start_period, :disable, { test: [] }],
@@ -17,6 +17,7 @@ class UffizziCore::Api::Cli::V1::Deployment::UpdateForm < UffizziCore::Deploymen
17
17
  :receive_incoming_requests,
18
18
  :continuously_deploy,
19
19
  { variables: [:name, :value],
20
+ additional_subdomains: [],
20
21
  secret_variables: [:name, :value],
21
22
  volumes: [:source, :target, :type, :read_only],
22
23
  healthcheck: [:test, :interval, :timeout, :retries, :start_period, :disable, { test: [] }],
@@ -19,6 +19,7 @@ class UffizziCore::Api::Cli::V1::Template::CreateForm < UffizziCore::Template
19
19
  :service_name,
20
20
  :name,
21
21
  { variables: [:name, :value],
22
+ additional_subdomains: [],
22
23
  secret_variables: [:name, :value],
23
24
  volumes: [:source, :target, :type, :read_only],
24
25
  healthcheck: [:test, :interval, :timeout, :retries, :start_period, :disable, { test: [] }],
@@ -18,7 +18,8 @@ class UffizziCore::Controller::DeployContainers::ContainerSerializer < UffizziCo
18
18
  :receive_incoming_requests,
19
19
  :healthcheck,
20
20
  :volumes,
21
- :service_name
21
+ :service_name,
22
+ :additional_subdomains
22
23
 
23
24
  has_many :container_config_files
24
25
 
@@ -27,6 +27,7 @@ class UffizziCore::ComposeFile::Builders::ContainerBuilderService
27
27
  container_name)
28
28
  is_ingress = ingress_container?(container_name, ingress_data)
29
29
  repo_attributes = repo_attributes(container_data, continuous_preview_global_data)
30
+ additional_subdomains = is_ingress ? ingress_data[:additional_subdomains] : []
30
31
 
31
32
  {
32
33
  tag: tag(image_data, repo_attributes),
@@ -47,6 +48,7 @@ class UffizziCore::ComposeFile::Builders::ContainerBuilderService
47
48
  name: container_name,
48
49
  healthcheck: healthcheck_data,
49
50
  volumes: volumes_data,
51
+ additional_subdomains: additional_subdomains,
50
52
  }
51
53
  end
52
54
  # rubocop:enable Metrics/PerceivedComplexity
@@ -7,11 +7,12 @@ class UffizziCore::ComposeFile::Parsers::IngressParserService
7
7
 
8
8
  container_name = container_name(ingress_data, services_data)
9
9
  port = port(ingress_data)
10
+ additional_attributes = build_additional_attributes(ingress_data, services_data)
10
11
 
11
12
  {
12
13
  container_name: container_name,
13
14
  port: port,
14
- }
15
+ }.merge(additional_attributes)
15
16
  end
16
17
 
17
18
  private
@@ -47,5 +48,9 @@ class UffizziCore::ComposeFile::Parsers::IngressParserService
47
48
 
48
49
  port
49
50
  end
51
+
52
+ def build_additional_attributes(*)
53
+ {}
54
+ end
50
55
  end
51
56
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  class UffizziCore::ComposeFileService
4
4
  class << self
5
+ include UffizziCore::DependencyInjectionConcern
6
+
5
7
  def create(params, kind)
6
8
  compose_file_form = create_compose_form(params, kind)
7
9
 
@@ -31,7 +33,7 @@ class UffizziCore::ComposeFileService
31
33
  continuous_preview_data = UffizziCore::ComposeFile::Parsers::ContinuousPreviewParserService.parse(continuous_preview_option)
32
34
 
33
35
  ingress_option = UffizziCore::ComposeFile::ConfigOptionService.ingress_option(compose_data)
34
- ingress_data = UffizziCore::ComposeFile::Parsers::IngressParserService.parse(ingress_option, compose_data['services'])
36
+ ingress_data = parse_ingress(ingress_option, compose_data)
35
37
 
36
38
  {
37
39
  containers: containers_data,
@@ -40,6 +42,17 @@ class UffizziCore::ComposeFileService
40
42
  }
41
43
  end
42
44
 
45
+ def parse_ingress(ingress_option, compose_data)
46
+ ingress_parser_module = find_ingress_parser_module
47
+
48
+ unless ingress_parser_module
49
+ return UffizziCore::ComposeFile::Parsers::IngressParserService.parse(ingress_option,
50
+ compose_data['services'])
51
+ end
52
+
53
+ ingress_parser_module.parse(ingress_option, compose_data['services'])
54
+ end
55
+
43
56
  def build_template_attributes(compose_data, source, credentials, project, compose_dependencies = [], compose_repositories = [])
44
57
  builder = UffizziCore::ComposeFile::Builders::TemplateBuilderService.new(credentials, project, compose_repositories)
45
58
 
@@ -99,7 +99,7 @@ class UffizziCore::DeploymentService
99
99
 
100
100
  def build_pull_request_subdomain(deployment)
101
101
  github_payload = deployment.metadata.dig('labels', 'github')
102
- repo_name = github_payload['repository'].split('/').last
102
+ repo_name = github_payload['repository'].split('/').last.downcase
103
103
  pull_request_number = github_payload['pull_request']['number']
104
104
  subdomain = "pr-#{pull_request_number}-#{name(deployment)}-#{repo_name}-#{deployment.project.slug}"
105
105
  format_subdomain(subdomain)
@@ -142,6 +142,6 @@ class UffizziCore::ManageActivityItemsService
142
142
  end
143
143
 
144
144
  def deployment_network_connectivity
145
- namespace_data&.metadata&.annotations&.network_connectivity || '{}'
145
+ namespace_data&.metadata&.annotations&.network_connectivity.presence || '{}'
146
146
  end
147
147
  end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddAdditionalSubdomainsToContainers < ActiveRecord::Migration[6.1]
4
+ def change
5
+ add_column(:uffizzi_core_containers, :additional_subdomains, :string, array: true, default: [])
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.0.1'
4
+ VERSION = '2.0.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: 2.0.1
4
+ version: 2.0.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-10-06 00:00:00.000000000 Z
12
+ date: 2022-10-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -521,6 +521,20 @@ dependencies:
521
521
  - - ">="
522
522
  - !ruby/object:Gem::Version
523
523
  version: '0'
524
+ - !ruby/object:Gem::Dependency
525
+ name: deepsort
526
+ requirement: !ruby/object:Gem::Requirement
527
+ requirements:
528
+ - - "~>"
529
+ - !ruby/object:Gem::Version
530
+ version: 0.4.5
531
+ type: :development
532
+ prerelease: false
533
+ version_requirements: !ruby/object:Gem::Requirement
534
+ requirements:
535
+ - - "~>"
536
+ - !ruby/object:Gem::Version
537
+ version: 0.4.5
524
538
  - !ruby/object:Gem::Dependency
525
539
  name: factory_bot
526
540
  requirement: !ruby/object:Gem::Requirement
@@ -987,6 +1001,7 @@ files:
987
1001
  - db/migrate/20220525113412_rename_name_to_uffizzi_containers.rb
988
1002
  - db/migrate/20220704135629_add_disabled_at_to_deployments.rb
989
1003
  - db/migrate/20220805164628_add_metadata_to_deployment.rb
1004
+ - db/migrate/20220927113647_add_additional_subdomains_to_containers.rb
990
1005
  - db/seeds.rb
991
1006
  - lib/tasks/uffizzi_core_tasks.rake
992
1007
  - lib/uffizzi_core.rb