uffizzi_core 2.1.24 → 2.1.25

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: de321ff2e21c9c9b909b4739eb07728d4399801c45d267c5608142d2634f519f
4
- data.tar.gz: 4550ded63ea25d6a480c0e9a93964285746fae2d6582e73bb6829eb3a18e9163
3
+ metadata.gz: 891fe1a03e5dd0dbc635156b946213cbedef67a792537d706e7247ec241c8c7a
4
+ data.tar.gz: a81611e8aa150c0d6bf1ac9f3bdbd549aefdfcfc1434f3ebe68688488bd509b8
5
5
  SHA512:
6
- metadata.gz: 3de13bddf08f86c9eb18e7d21b4ccd9ce074815a6716888357f3b93f99f4ed92da9be571296897240f7245e4f4709ff7fd183aab70a915072c15932cd00cae4e
7
- data.tar.gz: 8634b6e9021ec0f1a5fa883957a91ddbaa4e367e3d2f0b97da4a108c4b935c552bfb944dd6156ef06fb075395904e3d6ed69b59ea15b7af7611daed24a8b39d5
6
+ metadata.gz: 7de4b67a8fc79849717ac31c2e74511d8c017dad1adc70cdc94dc83ab022290c819dfd7cf68fda8b411399ec7b39efd0f774e351daecd25845cc84f82879cf33
7
+ data.tar.gz: '028258a7a6c4550b9921642df1d38e8ef3e87e63b0f95fefbb866eaf46614df97b114f6bf51fdfa82ff0190ed2abcf910a4602ada23e6850a6ddedbfa1fdd603'
@@ -51,6 +51,8 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
51
51
  # @response [object<errors: object<title: string>>] 404 Not found
52
52
  # @response 401 Not authorized
53
53
  def create
54
+ return render_deployment_exists_error if deployments.with_metadata.with_labels(metadata_params).exists?
55
+
54
56
  compose_file, errors = find_or_create_compose_file
55
57
  return render_invalid_file if compose_file.invalid_file?
56
58
  return render_errors(errors) if errors.present?
@@ -193,6 +195,10 @@ class UffizziCore::Api::Cli::V1::Projects::DeploymentsController < UffizziCore::
193
195
  end
194
196
 
195
197
  def render_invalid_file
196
- render json: { errors: { state: ['Invalid compose file'] } }, status: :unprocessable_entity
198
+ render json: { errors: { state: [I18n.t('compose.invalid_compose')] } }, status: :unprocessable_entity
199
+ end
200
+
201
+ def render_deployment_exists_error
202
+ render json: { errors: { state: [I18n.t('deployment.already_exists')] } }, status: :unprocessable_entity
197
203
  end
198
204
  end
@@ -12,7 +12,7 @@ module UffizziCore::DeploymentRepo
12
12
  scope :active_for_credential_id, ->(credential_id) {
13
13
  active.joins(project: :credentials).merge(UffizziCore::Project.active).where(credentials: { id: credential_id })
14
14
  }
15
-
15
+ scope :with_metadata, -> { where.not(metadata: {}) }
16
16
  scope :with_labels, ->(labels) {
17
17
  where("#{UffizziCore::Deployment.table_name}.metadata @> ?", labels.to_json)
18
18
  }
@@ -14,6 +14,7 @@ en:
14
14
  compose:
15
15
  unsupported_file: Unsupported compose file
16
16
  invalid_file: 'Syntax error: %{err} at line %{line} column %{column}'
17
+ invalid_compose: Invalid compose file
17
18
  invalid_config_option: Invalid config option '%{value}' - only a-zA-Z0-9._- characters are allowed
18
19
  no_services: Service services has neither an image nor a build context specified. At least one must be provided.
19
20
  invalid_service_name: "Invalid service name '%{value}': a service name must consist of lower case alphanumeric characters, ''-'', and must start and end with an alphanumeric character"
@@ -80,6 +81,7 @@ en:
80
81
 
81
82
  deployment:
82
83
  invalid_state: Preview with ID deployment-%{id} %{state}
84
+ already_exists: An active deployment already exists
83
85
 
84
86
  session:
85
87
  unsupported_login_type: This type of login is not supported
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UffizziCore
4
- VERSION = '2.1.24'
4
+ VERSION = '2.1.25'
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.1.24
4
+ version: 2.1.25
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: 2023-05-22 00:00:00.000000000 Z
12
+ date: 2023-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm