uffizzi_core 2.1.24 → 2.1.26

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: 72d1fe1b0397a4e5b6a0b95c5b9ad9374eb9c3dfef94c235e434b29daf44a8ed
4
+ data.tar.gz: cbb2423de1feebba8b114fbf2d76e38560426e6ca5006e0d14787571eb404e56
5
5
  SHA512:
6
- metadata.gz: 3de13bddf08f86c9eb18e7d21b4ccd9ce074815a6716888357f3b93f99f4ed92da9be571296897240f7245e4f4709ff7fd183aab70a915072c15932cd00cae4e
7
- data.tar.gz: 8634b6e9021ec0f1a5fa883957a91ddbaa4e367e3d2f0b97da4a108c4b935c552bfb944dd6156ef06fb075395904e3d6ed69b59ea15b7af7611daed24a8b39d5
6
+ metadata.gz: 80536080ab0b3f4e898d819cf1013e20db1cf4a1cdaa373463998cecac53648ecf4feb2f643de2a953f7afd921d0ffd4564b1989c05cdc5f5c1d640d33ecdbb1
7
+ data.tar.gz: 30339f6896549337c7c8c5a1cb59b21e2bbc28c3db3016c1b79ec091db83e2a6cf47704af8a91655628cba2a622a4194b8e5b640bdede3bd3df6c1f13a4013d6
@@ -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
@@ -27,7 +27,7 @@ module UffizziCore::Concerns::Models::Deployment
27
27
  validates :kind, presence: true
28
28
 
29
29
  enumerize :creation_source, in: [:manual, :demo, :continuous_preview, :compose_file_manual, :compose_file_continuous_preview,
30
- :github_actions], predicates: true, scope: true, default: :manual
30
+ :github_actions, :gitlab_actions], predicates: true, scope: true, default: :manual
31
31
 
32
32
  accepts_nested_attributes_for :containers, allow_destroy: true
33
33
 
@@ -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.26'
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.26
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-06-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aasm
@@ -876,7 +876,6 @@ files:
876
876
  - app/models/uffizzi_core/credential/azure.rb
877
877
  - app/models/uffizzi_core/credential/docker_hub.rb
878
878
  - app/models/uffizzi_core/credential/docker_registry.rb
879
- - app/models/uffizzi_core/credential/github.rb
880
879
  - app/models/uffizzi_core/credential/github_container_registry.rb
881
880
  - app/models/uffizzi_core/credential/google.rb
882
881
  - app/models/uffizzi_core/database.rb
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class UffizziCore::Credential::Github < UffizziCore::Credential
4
- end