uffizzi_core 0.2.1 → 0.2.4

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: adfd2aad21040ef9ab01dbd4057d37185b70a57d7886fad0add89e64ae4a1c77
4
- data.tar.gz: d1b593337123b302cf5e5a4986be2806f806a8afd4a7f9292940222e1225c857
3
+ metadata.gz: 95b83037cf5b0e2be7f85038f8e42a2cce5b44f90a92ff0f0f006ca6d518d03f
4
+ data.tar.gz: 777a69d65951babbeb3cb8d4624a8fcb813cf23afe2ce3af35e52da923044f07
5
5
  SHA512:
6
- metadata.gz: b6d2ee7b78505a764da65fb0e100678b35b9f8e974105b8e1600ee61dd499b3546653a556fa1531bbd14c0a5043fbae85d2f23d3701f209802fdd3e6951d8e7c
7
- data.tar.gz: 7fae0d641e8c2ec495fb2250931245a16893a2b9e88564c2e52cba0f94fa1cf9b4da1800cdc3606de53fcb1ea750e5e18bce39af405b34d6ac5cb1b459389334
6
+ metadata.gz: af3ae4e46eee3ab0f72c7370d956e92a5eefcb48ff3c05b51682148258014eee0e833994b481c910220148ab4a99e9b91ae3cf33e45c5659cdbcbe8a2ae9b2bc
7
+ data.tar.gz: becb67e6136eb7096113058058e2f4e16e5a92f2c6313513f3efef9f517ef6f5220444a8e99cca831d17b8b44940d87805b897bc009bf9385e2cf645917258b2
@@ -62,7 +62,7 @@ class UffizziCore::Api::Cli::V1::Projects::ComposeFilesController < UffizziCore:
62
62
 
63
63
  def compose_file
64
64
  compose_file = resource_project.compose_file
65
- raise ActiveRecord::RecordNotFound if compose_file.blank?
65
+ raise ActiveRecord::RecordNotFound.new("Couldn't find UffizziCore::ComposeFile", UffizziCore::ComposeFile) if compose_file.blank?
66
66
 
67
67
  compose_file
68
68
  end
@@ -11,11 +11,13 @@ class UffizziCore::ApplicationController < ActionController::Base
11
11
  DEFAULT_PER_PAGE = 20
12
12
 
13
13
  protect_from_forgery with: :exception
14
- rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
15
14
  RESCUABLE_EXCEPTIONS = [RuntimeError, TypeError, NameError, ArgumentError, SyntaxError].freeze
16
15
  rescue_from *RESCUABLE_EXCEPTIONS do |exception|
17
16
  render_server_error(exception)
18
17
  end
18
+ rescue_from ActiveRecord::RecordNotFound do |exception|
19
+ render_not_found(exception)
20
+ end
19
21
 
20
22
  before_action :authenticate_request!
21
23
  skip_before_action :verify_authenticity_token
@@ -29,8 +31,9 @@ class UffizziCore::ApplicationController < ActionController::Base
29
31
  UffizziCore::JsonResponder
30
32
  end
31
33
 
32
- def render_not_found
33
- render json: { errors: { title: ['Resource Not Found'] } }, status: :not_found
34
+ def render_not_found(exception)
35
+ resource = exception.model || 'Resource'
36
+ render json: { errors: { title: ["#{resource} Not Found"] } }, status: :not_found
34
37
  end
35
38
 
36
39
  def render_server_error(error)
@@ -7,7 +7,7 @@ class UffizziCore::ComposeFile::ConfigOptionService
7
7
  raise UffizziCore::ComposeFile::ParseError, I18n.t('compose.boolean_option', value: option)
8
8
  end
9
9
 
10
- option.match(/^[a-zA-Z_][a-zA-Z0-9._\-]+$/).present?
10
+ option.match(/^[\w.-]+$/).present?
11
11
  end
12
12
 
13
13
  def config_options(compose_data)
@@ -112,8 +112,8 @@ module UffizziCore::DeploymentService
112
112
  project = deployment.project
113
113
  continuous_preview_payload = deployment.continuous_preview_payload
114
114
  docker_payload = continuous_preview_payload['docker']
115
- repo_name = docker_payload['image'].split('/').last.gsub('_', '-')
116
- image_tag = docker_payload['tag'].gsub('_', '-')
115
+ repo_name = docker_payload['image'].split('/').last
116
+ image_tag = docker_payload['tag']
117
117
  deployment_name = name(deployment)
118
118
  subdomain = "#{image_tag}-#{deployment_name}-#{repo_name}-#{project.slug}"
119
119
 
@@ -298,10 +298,13 @@ module UffizziCore::DeploymentService
298
298
  end
299
299
 
300
300
  def format_subdomain(full_subdomain_name)
301
+ # Replace _ to - because RFC 1123 subdomain must consist of lower case alphanumeric characters,
302
+ # '-' or '.', and must start and end with an alphanumeric character
303
+ rfc_subdomain = full_subdomain_name.gsub('_', '-')
301
304
  subdomain_length_limit = Settings.deployment.subdomain.length_limit
302
- return full_subdomain_name if full_subdomain_name.length <= subdomain_length_limit
305
+ return rfc_subdomain if rfc_subdomain.length <= subdomain_length_limit
303
306
 
304
- full_subdomain_name.slice(0, subdomain_length_limit)
307
+ rfc_subdomain.slice(0, subdomain_length_limit)
305
308
  end
306
309
  end
307
310
  end
@@ -119,11 +119,7 @@ class UffizziCore::ManageActivityItemsService
119
119
  case pod_container_status.to_sym
120
120
  when :running
121
121
  UffizziCore::Event.state.deployed
122
- when :terminated
123
- UffizziCore::Event.state.failed
124
122
  when :waiting
125
- return UffizziCore::Event.state.failed if ['CrashLoopBackOff'].include?(reason)
126
-
127
123
  raise UffizziCore::Deployment::ImagePullError, @deployment.id if ['ErrImagePull', 'ImagePullBackOff'].include?(reason)
128
124
 
129
125
  UffizziCore::Event.state.deploying
@@ -13,7 +13,7 @@ en:
13
13
  compose:
14
14
  unsupported_file: Unsupported compose file
15
15
  invalid_file: Invalid compose file
16
- invalid_config_option: Invalid config option '%{value}' - only [a-zA-Z0-9\._\-] characters are allowed
16
+ invalid_config_option: Invalid config option '%{value}' - only a-zA-Z0-9._- characters are allowed
17
17
  no_services: Service services has neither an image nor a build context specified. At least one must be provided.
18
18
  no_ingress: Service ingress has not been defined.
19
19
  invalid_image_value: Invalid image value '%{value}'
@@ -30,7 +30,7 @@ en:
30
30
  invalid_memory_type: Memory '%{value}' contains an invalid type, it should be a string
31
31
  invalid_memory_value: Invalid memory value '%{value}'
32
32
  invalid_memory: The memory should be one of the `125m` `250m` `500m` `1000m` `2000m` `4000m` values
33
- image_build_no_specified: Service %{value} has neither an image nor a build context specified. At least one must be provided.
33
+ image_build_no_specified: Service '%{value}' has neither an image nor a build context specified. At least one must be provided.
34
34
  build_context_no_specified: The context option should be specified
35
35
  config_file_not_found: Config file not found '%{name}'
36
36
  invalid_context: Invalid context value '%{value}'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.4'
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.2.1
4
+ version: 0.2.4
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-06-10 00:00:00.000000000 Z
12
+ date: 2022-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm