Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-01-25 12:08:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-25 12:08:46 +0300
commit35487a1e925f7b4ec72a3d0cdde94f92582d2087 (patch)
tree5cb21f3e13cea333acc0101a45d92b237a78fd5e /app/models/serverless
parent4f749a9b30a638f0bd3a19e8d9925e966b0f5cb4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/serverless')
-rw-r--r--app/models/serverless/domain_cluster.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/serverless/domain_cluster.rb b/app/models/serverless/domain_cluster.rb
index a8365649dd1..44463a56327 100644
--- a/app/models/serverless/domain_cluster.rb
+++ b/app/models/serverless/domain_cluster.rb
@@ -4,11 +4,16 @@ module Serverless
class DomainCluster < ApplicationRecord
self.table_name = 'serverless_domain_cluster'
+ HEX_REGEXP = %r{\A\h+\z}.freeze
+
belongs_to :pages_domain
belongs_to :knative, class_name: 'Clusters::Applications::Knative', foreign_key: 'clusters_applications_knative_id'
belongs_to :creator, class_name: 'User', optional: true
- validates :pages_domain, :knative, :uuid, presence: true
- validates :uuid, uniqueness: true, length: { is: 14 }
+ validates :pages_domain, :knative, presence: true
+ validates :uuid, presence: true, uniqueness: true, length: { is: Gitlab::Serverless::Domain::UUID_LENGTH },
+ format: { with: HEX_REGEXP, message: 'only allows hex characters' }
+
+ default_value_for(:uuid, allows_nil: false) { Gitlab::Serverless::Domain.generate_uuid }
end
end