diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-14 22:34:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-14 22:34:26 +0300 |
commit | dd22031c62b54a03909b7be829f85032e556a031 (patch) | |
tree | 442a2fb32fedea24fb19e99bbc1cd22fc4cc9732 /app/models/project.rb | |
parent | ee98d5353d02654dc39c0d3534c04699e5aaab43 (diff) |
Add latest changes from gitlab-org/gitlab@14-8-stable-ee
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index de7dd42866f..f89e616a5ca 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -38,6 +38,7 @@ class Project < ApplicationRecord include GitlabRoutingHelper include BulkMemberAccessLoad include RunnerTokenExpirationInterval + include RunnersTokenPrefixable extend Gitlab::Cache::RequestCache extend Gitlab::Utils::Override @@ -89,11 +90,6 @@ class Project < ApplicationRecord DEFAULT_SQUASH_COMMIT_TEMPLATE = '%{title}' - # Prefix for runners_token which can be used to invalidate existing tokens. - # The value chosen here is GR (for Gitlab Runner) combined with the rotation - # date (20220225) decimal to hex encoded. - RUNNERS_TOKEN_PREFIX = 'GR1348941' - cache_markdown_field :description, pipeline: :description default_value_for :packages_enabled, true @@ -116,7 +112,7 @@ class Project < ApplicationRecord add_authentication_token_field :runners_token, encrypted: -> { Feature.enabled?(:projects_tokens_optional_encryption, default_enabled: true) ? :optional : :required }, - prefix: ->(instance) { instance.runners_token_prefix } + prefix: RunnersTokenPrefixable::RUNNERS_TOKEN_PREFIX before_validation :mark_remote_mirrors_for_removal, if: -> { RemoteMirror.table_exists? } @@ -1881,7 +1877,7 @@ class Project < ApplicationRecord end def runners_token_prefix - Feature.enabled?(:projects_runners_token_prefix, self, default_enabled: :yaml) ? RUNNERS_TOKEN_PREFIX : '' + RUNNERS_TOKEN_PREFIX end override :format_runners_token |