Commit e908e117 authored by dineshpanda's avatar dineshpanda

Avoid calling freeze on already frozen strings in lib/gitlab

parent df6f1dd9
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module Auth module Auth
class UniqueIpsLimiter class UniqueIpsLimiter
USER_UNIQUE_IPS_PREFIX = 'user_unique_ips'.freeze USER_UNIQUE_IPS_PREFIX = 'user_unique_ips'
class << self class << self
def limit_user_id!(user_id) def limit_user_id!(user_id)
......
...@@ -20,7 +20,7 @@ module Gitlab ...@@ -20,7 +20,7 @@ module Gitlab
module UserAuthFinders module UserAuthFinders
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
PRIVATE_TOKEN_HEADER = 'HTTP_PRIVATE_TOKEN'.freeze PRIVATE_TOKEN_HEADER = 'HTTP_PRIVATE_TOKEN'
PRIVATE_TOKEN_PARAM = :private_token PRIVATE_TOKEN_PARAM = :private_token
# Check the Rails session for valid authentication details # Check the Rails session for valid authentication details
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
include Gitlab::Utils::StrongMemoize include Gitlab::Utils::StrongMemoize
RESCHEDULE_DELAY = 3.hours RESCHEDULE_DELAY = 3.hours
WORKER = 'PopulateMergeRequestAssigneesTable'.freeze WORKER = 'PopulateMergeRequestAssigneesTable'
DeadJobsError = Class.new(StandardError) DeadJobsError = Class.new(StandardError)
def perform def perform
......
...@@ -10,15 +10,15 @@ module Gitlab ...@@ -10,15 +10,15 @@ module Gitlab
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
FIND_BATCH_SIZE = 500 FIND_BATCH_SIZE = 500
RELATIVE_UPLOAD_DIR = "uploads".freeze RELATIVE_UPLOAD_DIR = "uploads"
ABSOLUTE_UPLOAD_DIR = File.join( ABSOLUTE_UPLOAD_DIR = File.join(
Gitlab.config.uploads.storage_path, Gitlab.config.uploads.storage_path,
RELATIVE_UPLOAD_DIR RELATIVE_UPLOAD_DIR
) )
FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'.freeze FOLLOW_UP_MIGRATION = 'PopulateUntrackedUploads'
START_WITH_ROOT_REGEX = %r{\A#{Gitlab.config.uploads.storage_path}/}.freeze START_WITH_ROOT_REGEX = %r{\A#{Gitlab.config.uploads.storage_path}/}.freeze
EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*".freeze EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*"
EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*".freeze EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*"
# This class is used to iterate over batches of # This class is used to iterate over batches of
# `untracked_files_for_uploads` rows. # `untracked_files_for_uploads` rows.
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
attr_reader :project, :project_key, :repository_slug, :client, :errors, :users attr_reader :project, :project_key, :repository_slug, :client, :errors, :users
attr_accessor :logger attr_accessor :logger
REMOTE_NAME = 'bitbucket_server'.freeze REMOTE_NAME = 'bitbucket_server'
BATCH_SIZE = 100 BATCH_SIZE = 100
TempBranch = Struct.new(:name, :sha) TempBranch = Struct.new(:name, :sha)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
module Gitlab module Gitlab
module Checks module Checks
class LfsCheck < BaseChecker class LfsCheck < BaseChecker
LOG_MESSAGE = "Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab...".freeze LOG_MESSAGE = 'Scanning repository for blobs stored in LFS and verifying their files have been uploaded to GitLab...'
ERROR_MESSAGE = 'LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".'.freeze ERROR_MESSAGE = 'LFS objects are missing. Ensure LFS is properly set up or try a manual "git lfs push --all".'
def validate! def validate!
return unless Feature.enabled?(:lfs_check, default_enabled: true) return unless Feature.enabled?(:lfs_check, default_enabled: true)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module Checks module Checks
class ProjectCreated < PostPushMessage class ProjectCreated < PostPushMessage
PROJECT_CREATED = "project_created".freeze PROJECT_CREATED = "project_created"
def message def message
<<~MESSAGE <<~MESSAGE
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module Checks module Checks
class ProjectMoved < PostPushMessage class ProjectMoved < PostPushMessage
REDIRECT_NAMESPACE = "redirect_namespace".freeze REDIRECT_NAMESPACE = "redirect_namespace"
def initialize(project, user, protocol, redirected_path) def initialize(project, user, protocol, redirected_path)
@redirected_path = redirected_path @redirected_path = redirected_path
......
...@@ -4,8 +4,8 @@ module Gitlab ...@@ -4,8 +4,8 @@ module Gitlab
module Ci module Ci
module Build module Build
class Port class Port
DEFAULT_PORT_NAME = 'default_port'.freeze DEFAULT_PORT_NAME = 'default_port'
DEFAULT_PORT_PROTOCOL = 'http'.freeze DEFAULT_PORT_PROTOCOL = 'http'
attr_reader :number, :protocol, :name attr_reader :number, :protocol, :name
......
...@@ -4,9 +4,9 @@ module Gitlab ...@@ -4,9 +4,9 @@ module Gitlab
module Ci module Ci
module Build module Build
class Step class Step
WHEN_ON_FAILURE = 'on_failure'.freeze WHEN_ON_FAILURE = 'on_failure'
WHEN_ON_SUCCESS = 'on_success'.freeze WHEN_ON_SUCCESS = 'on_success'
WHEN_ALWAYS = 'always'.freeze WHEN_ALWAYS = 'always'
attr_reader :name attr_reader :name
attr_accessor :script, :timeout, :when, :allow_failure attr_accessor :script, :timeout, :when, :allow_failure
......
...@@ -12,7 +12,7 @@ module Gitlab ...@@ -12,7 +12,7 @@ module Gitlab
include ::Gitlab::Config::Entry::Attributable include ::Gitlab::Config::Entry::Attributable
ALLOWED_KEYS = %i[key untracked paths policy].freeze ALLOWED_KEYS = %i[key untracked paths policy].freeze
DEFAULT_POLICY = 'pull-push'.freeze DEFAULT_POLICY = 'pull-push'
validations do validations do
validates :config, allowed_keys: ALLOWED_KEYS validates :config, allowed_keys: ALLOWED_KEYS
......
...@@ -8,7 +8,7 @@ module Gitlab ...@@ -8,7 +8,7 @@ module Gitlab
class Template < Base class Template < Base
attr_reader :location, :project attr_reader :location, :project
SUFFIX = '.gitlab-ci.yml'.freeze SUFFIX = '.gitlab-ci.yml'
def initialize(params, context) def initialize(params, context)
@location = params[:template] @location = params[:template]
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
module Gitlab module Gitlab
module Ci module Ci
class CronParser class CronParser
VALID_SYNTAX_SAMPLE_TIME_ZONE = 'UTC'.freeze VALID_SYNTAX_SAMPLE_TIME_ZONE = 'UTC'
VALID_SYNTAX_SAMPLE_CRON = '* * * * *'.freeze VALID_SYNTAX_SAMPLE_CRON = '* * * * *'
def initialize(cron, cron_timezone = 'UTC') def initialize(cron, cron_timezone = 'UTC')
@cron = cron @cron = cron
......
...@@ -4,10 +4,10 @@ module Gitlab ...@@ -4,10 +4,10 @@ module Gitlab
module Ci module Ci
module Reports module Reports
class TestCase class TestCase
STATUS_SUCCESS = 'success'.freeze STATUS_SUCCESS = 'success'
STATUS_FAILED = 'failed'.freeze STATUS_FAILED = 'failed'
STATUS_SKIPPED = 'skipped'.freeze STATUS_SKIPPED = 'skipped'
STATUS_ERROR = 'error'.freeze STATUS_ERROR = 'error'
STATUS_TYPES = [STATUS_SUCCESS, STATUS_FAILED, STATUS_SKIPPED, STATUS_ERROR].freeze STATUS_TYPES = [STATUS_SUCCESS, STATUS_FAILED, STATUS_SKIPPED, STATUS_ERROR].freeze
attr_reader :name, :classname, :execution_time, :status, :file, :system_output, :stack_trace, :key attr_reader :name, :classname, :execution_time, :status, :file, :system_output, :stack_trace, :key
......
...@@ -5,9 +5,9 @@ module Gitlab ...@@ -5,9 +5,9 @@ module Gitlab
class ProjectUploadFileFinder class ProjectUploadFileFinder
FIND_BATCH_SIZE = 500 FIND_BATCH_SIZE = 500
ABSOLUTE_UPLOAD_DIR = FileUploader.root.freeze ABSOLUTE_UPLOAD_DIR = FileUploader.root.freeze
EXCLUDED_SYSTEM_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/-/*".freeze EXCLUDED_SYSTEM_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/-/*"
EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*".freeze EXCLUDED_HASHED_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/@hashed/*"
EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*".freeze EXCLUDED_TMP_UPLOADS_PATH = "#{ABSOLUTE_UPLOAD_DIR}/tmp/*"
# Paths are relative to the upload directory # Paths are relative to the upload directory
def each_file_batch(batch_size: FIND_BATCH_SIZE, &block) def each_file_batch(batch_size: FIND_BATCH_SIZE, &block)
......
...@@ -12,7 +12,7 @@ module Gitlab ...@@ -12,7 +12,7 @@ module Gitlab
# using them as if they were stored as string values. This gives you the # using them as if they were stored as string values. This gives you the
# ease of use of string values, but without the storage overhead. # ease of use of string values, but without the storage overhead.
class ShaAttribute < BINARY_TYPE class ShaAttribute < BINARY_TYPE
PACK_FORMAT = 'H*'.freeze PACK_FORMAT = 'H*'
# Casts binary data to a SHA1 in hexadecimal. # Casts binary data to a SHA1 in hexadecimal.
def deserialize(value) def deserialize(value)
......
...@@ -5,8 +5,8 @@ module Gitlab ...@@ -5,8 +5,8 @@ module Gitlab
class Message class Message
attr_reader :path, :offline attr_reader :path, :offline
OFFLINE = "\e[31moffline\e[0m".freeze OFFLINE = "\e[31moffline\e[0m"
ONLINE = "\e[32monline\e[0m".freeze ONLINE = "\e[32monline\e[0m"
# path - The file path of the migration. # path - The file path of the migration.
# offline - When set to `true` the migration will require downtime. # offline - When set to `true` the migration will require downtime.
......
# coding: utf-8
# frozen_string_literal: true # frozen_string_literal: true
# rubocop: disable Rails/Output # rubocop: disable Rails/Output
module Gitlab module Gitlab
# Checks if a set of migrations requires downtime or not. # Checks if a set of migrations requires downtime or not.
class EeCompatCheck class EeCompatCheck
CANONICAL_CE_PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-ce'.freeze CANONICAL_CE_PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-ce'
CANONICAL_EE_REPO_URL = 'https://gitlab.com/gitlab-org/gitlab-ee.git'.freeze CANONICAL_EE_REPO_URL = 'https://gitlab.com/gitlab-org/gitlab-ee.git'
CHECK_DIR = Rails.root.join('ee_compat_check') CHECK_DIR = Rails.root.join('ee_compat_check')
IGNORED_FILES_REGEX = /VERSION|CHANGELOG\.md|doc\/.+/i.freeze IGNORED_FILES_REGEX = /VERSION|CHANGELOG\.md|doc\/.+/i.freeze
PLEASE_READ_THIS_BANNER = %Q{ PLEASE_READ_THIS_BANNER = %Q{
......
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
module EtagCaching module EtagCaching
class Store class Store
EXPIRY_TIME = 20.minutes EXPIRY_TIME = 20.minutes
SHARED_STATE_NAMESPACE = 'etag:'.freeze SHARED_STATE_NAMESPACE = 'etag:'
def get(key) def get(key)
Gitlab::Redis::SharedState.with { |redis| redis.get(redis_shared_state_key(key)) } Gitlab::Redis::SharedState.with { |redis| redis.get(redis_shared_state_key(key)) }
......
...@@ -7,11 +7,11 @@ module Gitlab ...@@ -7,11 +7,11 @@ module Gitlab
# The ID of empty tree. # The ID of empty tree.
# See http://stackoverflow.com/a/40884093/1856239 and # See http://stackoverflow.com/a/40884093/1856239 and
# https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012 # https://github.com/git/git/blob/3ad8b5bf26362ac67c9020bf8c30eee54a84f56d/cache.h#L1011-L1012
EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'.freeze EMPTY_TREE_ID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
BLANK_SHA = ('0' * 40).freeze BLANK_SHA = ('0' * 40).freeze
COMMIT_ID = /\A[0-9a-f]{40}\z/.freeze COMMIT_ID = /\A[0-9a-f]{40}\z/.freeze
TAG_REF_PREFIX = "refs/tags/".freeze TAG_REF_PREFIX = "refs/tags/"
BRANCH_REF_PREFIX = "refs/heads/".freeze BRANCH_REF_PREFIX = "refs/heads/"
BaseError = Class.new(StandardError) BaseError = Class.new(StandardError)
CommandError = Class.new(BaseError) CommandError = Class.new(BaseError)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
module Gitlab module Gitlab
module Git module Git
class LfsPointerFile class LfsPointerFile
VERSION = "https://git-lfs.github.com/spec/v1".freeze VERSION = "https://git-lfs.github.com/spec/v1"
VERSION_LINE = "version #{VERSION}".freeze VERSION_LINE = "version #{VERSION}"
def initialize(data) def initialize(data)
@data = data @data = data
......
...@@ -15,9 +15,9 @@ module Gitlab ...@@ -15,9 +15,9 @@ module Gitlab
SEARCH_CONTEXT_LINES = 3 SEARCH_CONTEXT_LINES = 3
REV_LIST_COMMIT_LIMIT = 2_000 REV_LIST_COMMIT_LIMIT = 2_000
GITALY_INTERNAL_URL = 'ssh://gitaly/internal.git'.freeze GITALY_INTERNAL_URL = 'ssh://gitaly/internal.git'
GITLAB_PROJECTS_TIMEOUT = Gitlab.config.gitlab_shell.git_timeout GITLAB_PROJECTS_TIMEOUT = Gitlab.config.gitlab_shell.git_timeout
EMPTY_REPOSITORY_CHECKSUM = '0000000000000000000000000000000000000000'.freeze EMPTY_REPOSITORY_CHECKSUM = '0000000000000000000000000000000000000000'
NoRepository = Class.new(StandardError) NoRepository = Class.new(StandardError)
InvalidRepository = Class.new(StandardError) InvalidRepository = Class.new(StandardError)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
module Gitlab module Gitlab
module Git module Git
module Util module Util
LINE_SEP = "\n".freeze LINE_SEP = "\n"
def self.count_lines(string) def self.count_lines(string)
case string[-1] case string[-1]
......
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -10,7 +10,7 @@ module Gitlab
attr_reader :project, :object attr_reader :project, :object
# The base cache key to use for storing/retrieving issuable IDs. # The base cache key to use for storing/retrieving issuable IDs.
CACHE_KEY = 'github-import/issuable-finder/%{project}/%{type}/%{iid}'.freeze CACHE_KEY = 'github-import/issuable-finder/%{project}/%{type}/%{iid}'
# project - An instance of `Project`. # project - An instance of `Project`.
# object - The object to look up or set a database ID for. # object - The object to look up or set a database ID for.
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
attr_reader :project attr_reader :project
# The base cache key to use for storing/retrieving label IDs. # The base cache key to use for storing/retrieving label IDs.
CACHE_KEY = 'github-import/label-finder/%{project}/%{name}'.freeze CACHE_KEY = 'github-import/label-finder/%{project}/%{name}'
# project - An instance of `Project`. # project - An instance of `Project`.
def initialize(project) def initialize(project)
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
attr_reader :project attr_reader :project
# The base cache key to use for storing/retrieving milestone IDs. # The base cache key to use for storing/retrieving milestone IDs.
CACHE_KEY = 'github-import/milestone-finder/%{project}/%{iid}'.freeze CACHE_KEY = 'github-import/milestone-finder/%{project}/%{iid}'
# project - An instance of `Project` # project - An instance of `Project`
def initialize(project) def initialize(project)
......
...@@ -9,7 +9,7 @@ module Gitlab ...@@ -9,7 +9,7 @@ module Gitlab
attr_reader :cache_key attr_reader :cache_key
# The base cache key to use for storing the last page number. # The base cache key to use for storing the last page number.
CACHE_KEY = 'github-importer/page-counter/%{project}/%{collection}'.freeze CACHE_KEY = 'github-importer/page-counter/%{project}/%{collection}'
def initialize(project, collection) def initialize(project, collection)
@cache_key = CACHE_KEY % { project: project.id, collection: collection } @cache_key = CACHE_KEY % { project: project.id, collection: collection }
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
# The base cache key to use for tracking already imported objects. # The base cache key to use for tracking already imported objects.
ALREADY_IMPORTED_CACHE_KEY = ALREADY_IMPORTED_CACHE_KEY =
'github-importer/already-imported/%{project}/%{collection}'.freeze 'github-importer/already-imported/%{project}/%{collection}'
# project - An instance of `Project`. # project - An instance of `Project`.
# client - An instance of `Gitlab::GithubImport::Client`. # client - An instance of `Gitlab::GithubImport::Client`.
......
...@@ -16,17 +16,17 @@ module Gitlab ...@@ -16,17 +16,17 @@ module Gitlab
# The base cache key to use for caching user IDs for a given GitHub user # The base cache key to use for caching user IDs for a given GitHub user
# ID. # ID.
ID_CACHE_KEY = 'github-import/user-finder/user-id/%s'.freeze ID_CACHE_KEY = 'github-import/user-finder/user-id/%s'
# The base cache key to use for caching user IDs for a given GitHub email # The base cache key to use for caching user IDs for a given GitHub email
# address. # address.
ID_FOR_EMAIL_CACHE_KEY = ID_FOR_EMAIL_CACHE_KEY =
'github-import/user-finder/id-for-email/%s'.freeze 'github-import/user-finder/id-for-email/%s'
# The base cache key to use for caching the Email addresses of GitHub # The base cache key to use for caching the Email addresses of GitHub
# usernames. # usernames.
EMAIL_FOR_USERNAME_CACHE_KEY = EMAIL_FOR_USERNAME_CACHE_KEY =
'github-import/user-finder/email-for-username/%s'.freeze 'github-import/user-finder/email-for-username/%s'
# project - An instance of `Project` # project - An instance of `Project`
# client - An instance of `Gitlab::GithubImport::Client` # client - An instance of `Gitlab::GithubImport::Client`
......
...@@ -5,7 +5,7 @@ module Gitlab ...@@ -5,7 +5,7 @@ module Gitlab
class GitalyCheck class GitalyCheck
extend BaseAbstractCheck extend BaseAbstractCheck
METRIC_PREFIX = 'gitaly_health_check'.freeze METRIC_PREFIX = 'gitaly_health_check'
class << self class << self
def readiness def readiness
......
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
# For every version update the version history in these docs must be kept up to date: # For every version update the version history in these docs must be kept up to date:
# - development/import_export.md # - development/import_export.md
# - user/project/settings/import_export.md # - user/project/settings/import_export.md
VERSION = '0.2.4'.freeze VERSION = '0.2.4'
FILENAME_LIMIT = 50 FILENAME_LIMIT = 50
def export_path(relative_path:) def export_path(relative_path:)
......
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -10,7 +10,7 @@ module Gitlab
StrategyError = Class.new(StandardError) StrategyError = Class.new(StandardError)
AFTER_EXPORT_LOCK_FILE_NAME = '.after_export_action'.freeze AFTER_EXPORT_LOCK_FILE_NAME = '.after_export_action'
private private
......
...@@ -4,9 +4,9 @@ module Gitlab ...@@ -4,9 +4,9 @@ module Gitlab
module ImportExport module ImportExport
module AfterExportStrategies module AfterExportStrategies
class WebUploadStrategy < BaseAfterExportStrategy class WebUploadStrategy < BaseAfterExportStrategy
PUT_METHOD = 'PUT'.freeze PUT_METHOD = 'PUT'
POST_METHOD = 'POST'.freeze POST_METHOD = 'POST'
INVALID_HTTP_METHOD = 'invalid. Only PUT and POST methods allowed.'.freeze INVALID_HTTP_METHOD = 'invalid. Only PUT and POST methods allowed.'
validates :url, addressable_url: true validates :url, addressable_url: true
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
module Gitlab module Gitlab
module IncomingEmail module IncomingEmail
UNSUBSCRIBE_SUFFIX = '-unsubscribe'.freeze UNSUBSCRIBE_SUFFIX = '-unsubscribe'
UNSUBSCRIBE_SUFFIX_LEGACY = '+unsubscribe'.freeze UNSUBSCRIBE_SUFFIX_LEGACY = '+unsubscribe'
WILDCARD_PLACEHOLDER = '%{key}'.freeze WILDCARD_PLACEHOLDER = '%{key}'
class << self class << self
def enabled? def enabled?
......
...@@ -17,7 +17,7 @@ module Gitlab ...@@ -17,7 +17,7 @@ module Gitlab
# push to that array when done. Once the waiter has popped `count` items, it # push to that array when done. Once the waiter has popped `count` items, it
# knows all the jobs are done. # knows all the jobs are done.
class JobWaiter class JobWaiter
KEY_PREFIX = "gitlab:job_waiter".freeze KEY_PREFIX = "gitlab:job_waiter"
def self.notify(key, jid) def self.notify(key, jid)
Gitlab::Redis::SharedState.with { |redis| redis.lpush(key, jid) } Gitlab::Redis::SharedState.with { |redis| redis.lpush(key, jid) }
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Helm module Helm
HELM_VERSION = '2.14.3'.freeze HELM_VERSION = '2.14.3'
KUBECTL_VERSION = '1.11.10'.freeze KUBECTL_VERSION = '1.11.10'
NAMESPACE = 'gitlab-managed-apps'.freeze NAMESPACE = 'gitlab-managed-apps'
SERVICE_ACCOUNT = 'tiller'.freeze SERVICE_ACCOUNT = 'tiller'
CLUSTER_ROLE_BINDING = 'tiller-admin'.freeze CLUSTER_ROLE_BINDING = 'tiller-admin'
CLUSTER_ROLE = 'cluster-admin'.freeze CLUSTER_ROLE = 'cluster-admin'
end end
end end
end end
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
module Gitlab module Gitlab
module Kubernetes module Kubernetes
module Pod module Pod
PENDING = 'Pending'.freeze PENDING = 'Pending'
RUNNING = 'Running'.freeze RUNNING = 'Running'
SUCCEEDED = 'Succeeded'.freeze SUCCEEDED = 'Succeeded'
FAILED = 'Failed'.freeze FAILED = 'Failed'
UNKNOWN = 'Unknown'.freeze UNKNOWN = 'Unknown'
PHASES = [PENDING, RUNNING, SUCCEEDED, FAILED, UNKNOWN].freeze PHASES = [PENDING, RUNNING, SUCCEEDED, FAILED, UNKNOWN].freeze
end end
end end
......
...@@ -40,7 +40,7 @@ module Gitlab ...@@ -40,7 +40,7 @@ module Gitlab
end end
def self.cache_key def self.cache_key
'logger:'.freeze + self.full_log_path.to_s 'logger:' + self.full_log_path.to_s
end end
end end
end end
...@@ -15,7 +15,7 @@ module Gitlab ...@@ -15,7 +15,7 @@ module Gitlab
attach_to :action_view attach_to :action_view
SERIES = 'views'.freeze SERIES = 'views'
def render_template(event) def render_template(event)
track(event) if current_transaction track(event) if current_transaction
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
THREAD_KEY = :_gitlab_metrics_transaction THREAD_KEY = :_gitlab_metrics_transaction
# The series to store events (e.g. Git pushes) in. # The series to store events (e.g. Git pushes) in.
EVENT_SERIES = 'events'.freeze EVENT_SERIES = 'events'
attr_reader :tags, :values, :method, :metrics attr_reader :tags, :values, :method, :metrics
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
module Gitlab module Gitlab
module Metrics module Metrics
class WebTransaction < Transaction class WebTransaction < Transaction
CONTROLLER_KEY = 'action_controller.instance'.freeze CONTROLLER_KEY = 'action_controller.instance'
ENDPOINT_KEY = 'api.endpoint'.freeze ENDPOINT_KEY = 'api.endpoint'
ALLOWED_SUFFIXES = Set.new(%w[json js atom rss xml zip]) ALLOWED_SUFFIXES = Set.new(%w[json js atom rss xml zip])
def initialize(env) def initialize(env)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
module Gitlab module Gitlab
module Middleware module Middleware
class Multipart class Multipart
RACK_ENV_KEY = 'HTTP_GITLAB_WORKHORSE_MULTIPART_FIELDS'.freeze RACK_ENV_KEY = 'HTTP_GITLAB_WORKHORSE_MULTIPART_FIELDS'
class Handler class Handler
def initialize(env, message) def initialize(env, message)
......
...@@ -5,9 +5,9 @@ module Gitlab ...@@ -5,9 +5,9 @@ module Gitlab
class ReadOnly class ReadOnly
class Controller class Controller
DISALLOWED_METHODS = %w(POST PATCH PUT DELETE).freeze DISALLOWED_METHODS = %w(POST PATCH PUT DELETE).freeze
APPLICATION_JSON = 'application/json'.freeze APPLICATION_JSON = 'application/json'
APPLICATION_JSON_TYPES = %W{#{APPLICATION_JSON} application/vnd.git-lfs+json}.freeze APPLICATION_JSON_TYPES = %W{#{APPLICATION_JSON} application/vnd.git-lfs+json}.freeze
ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance'.freeze ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance'
WHITELISTED_GIT_ROUTES = { WHITELISTED_GIT_ROUTES = {
'projects/git_http' => %w{git_upload_pack git_receive_pack} 'projects/git_http' => %w{git_upload_pack git_receive_pack}
......
...@@ -125,9 +125,9 @@ module Gitlab ...@@ -125,9 +125,9 @@ module Gitlab
# allow non-regex validations, etc), `NAMESPACE_FORMAT_REGEX_JS` serves as a Javascript-compatible version of # allow non-regex validations, etc), `NAMESPACE_FORMAT_REGEX_JS` serves as a Javascript-compatible version of
# `NAMESPACE_FORMAT_REGEX`, with the negative lookbehind assertion removed. This means that the client-side validation # `NAMESPACE_FORMAT_REGEX`, with the negative lookbehind assertion removed. This means that the client-side validation
# will pass for usernames ending in `.atom` and `.git`, but will be caught by the server-side validation. # will pass for usernames ending in `.atom` and `.git`, but will be caught by the server-side validation.
PATH_START_CHAR = '[a-zA-Z0-9_\.]'.freeze PATH_START_CHAR = '[a-zA-Z0-9_\.]'
PATH_REGEX_STR = PATH_START_CHAR + '[a-zA-Z0-9_\-\.]*'.freeze PATH_REGEX_STR = PATH_START_CHAR + '[a-zA-Z0-9_\-\.]*'
NAMESPACE_FORMAT_REGEX_JS = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'.freeze NAMESPACE_FORMAT_REGEX_JS = PATH_REGEX_STR + '[a-zA-Z0-9_\-]|[a-zA-Z0-9_]'
NO_SUFFIX_REGEX = /(?<!\.git|\.atom)/.freeze NO_SUFFIX_REGEX = /(?<!\.git|\.atom)/.freeze
NAMESPACE_FORMAT_REGEX = /(?:#{NAMESPACE_FORMAT_REGEX_JS})#{NO_SUFFIX_REGEX}/.freeze NAMESPACE_FORMAT_REGEX = /(?:#{NAMESPACE_FORMAT_REGEX_JS})#{NO_SUFFIX_REGEX}/.freeze
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module PerformanceBar module PerformanceBar
ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids:v2'.freeze ALLOWED_USER_IDS_KEY = 'performance_bar_allowed_user_ids:v2'
EXPIRY_TIME_L1_CACHE = 1.minute EXPIRY_TIME_L1_CACHE = 1.minute
EXPIRY_TIME_L2_CACHE = 5.minutes EXPIRY_TIME_L2_CACHE = 5.minutes
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
class PollingInterval class PollingInterval
HEADER_NAME = 'Poll-Interval'.freeze HEADER_NAME = 'Poll-Interval'
def self.set_header(response, interval:) def self.set_header(response, interval:)
if polling_enabled? if polling_enabled?
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
module PrivateCommitEmail module PrivateCommitEmail
TOKEN = "_private".freeze TOKEN = "_private"
class << self class << self
def regex def regex
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module Profiler module Profiler
FILTERED_STRING = '[FILTERED]'.freeze FILTERED_STRING = '[FILTERED]'
IGNORE_BACKTRACES = %w[ IGNORE_BACKTRACES = %w[
lib/gitlab/i18n.rb lib/gitlab/i18n.rb
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module Prometheus module Prometheus
module AdditionalMetricsParser module AdditionalMetricsParser
CONFIG_ROOT = 'config/prometheus'.freeze CONFIG_ROOT = 'config/prometheus'
MUTEX = Mutex.new MUTEX = Mutex.new
extend self extend self
......
...@@ -5,8 +5,8 @@ module Gitlab ...@@ -5,8 +5,8 @@ module Gitlab
# Middleware for reporting (or raising) when a request performs more than a # Middleware for reporting (or raising) when a request performs more than a
# certain amount of database queries. # certain amount of database queries.
class Middleware class Middleware
CONTROLLER_KEY = 'action_controller.instance'.freeze CONTROLLER_KEY = 'action_controller.instance'
ENDPOINT_KEY = 'api.endpoint'.freeze ENDPOINT_KEY = 'api.endpoint'
def initialize(app) def initialize(app)
@app = app @app = app
......
# coding: utf-8
# frozen_string_literal: true # frozen_string_literal: true
module Gitlab module Gitlab
...@@ -6,8 +7,8 @@ module Gitlab ...@@ -6,8 +7,8 @@ module Gitlab
extend ActiveSupport::Concern extend ActiveSupport::Concern
include Gitlab::QuickActions::Dsl include Gitlab::QuickActions::Dsl
SHRUG = '¯\\_(ツ)_/¯'.freeze SHRUG = '¯\\_(ツ)_/¯'
TABLEFLIP = '(╯°□°)╯︵ ┻━┻'.freeze TABLEFLIP = '(╯°□°)╯︵ ┻━┻'
included do included do
# Issue, MergeRequest, Epic: quick actions definitions # Issue, MergeRequest, Epic: quick actions definitions
......
...@@ -6,9 +6,9 @@ require_relative 'wrapper' unless defined?(::Rails) && ::Rails.root.present? ...@@ -6,9 +6,9 @@ require_relative 'wrapper' unless defined?(::Rails) && ::Rails.root.present?
module Gitlab module Gitlab
module Redis module Redis
class Cache < ::Gitlab::Redis::Wrapper class Cache < ::Gitlab::Redis::Wrapper
CACHE_NAMESPACE = 'cache:gitlab'.freeze CACHE_NAMESPACE = 'cache:gitlab'
DEFAULT_REDIS_CACHE_URL = 'redis://localhost:6380'.freeze DEFAULT_REDIS_CACHE_URL = 'redis://localhost:6380'
REDIS_CACHE_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_CACHE_CONFIG_FILE'.freeze REDIS_CACHE_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_CACHE_CONFIG_FILE'
class << self class << self
def default_url def default_url
......
...@@ -6,10 +6,10 @@ require_relative 'wrapper' unless defined?(::Gitlab::Redis::Wrapper) ...@@ -6,10 +6,10 @@ require_relative 'wrapper' unless defined?(::Gitlab::Redis::Wrapper)
module Gitlab module Gitlab
module Redis module Redis
class Queues < ::Gitlab::Redis::Wrapper class Queues < ::Gitlab::Redis::Wrapper
SIDEKIQ_NAMESPACE = 'resque:gitlab'.freeze SIDEKIQ_NAMESPACE = 'resque:gitlab'
MAILROOM_NAMESPACE = 'mail_room:gitlab'.freeze MAILROOM_NAMESPACE = 'mail_room:gitlab'
DEFAULT_REDIS_QUEUES_URL = 'redis://localhost:6381'.freeze DEFAULT_REDIS_QUEUES_URL = 'redis://localhost:6381'
REDIS_QUEUES_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_QUEUES_CONFIG_FILE'.freeze REDIS_QUEUES_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_QUEUES_CONFIG_FILE'
class << self class << self
def default_url def default_url
......
...@@ -6,12 +6,12 @@ require_relative 'wrapper' unless defined?(::Gitlab::Redis::Wrapper) ...@@ -6,12 +6,12 @@ require_relative 'wrapper' unless defined?(::Gitlab::Redis::Wrapper)
module Gitlab module Gitlab
module Redis module Redis
class SharedState < ::Gitlab::Redis::Wrapper class SharedState < ::Gitlab::Redis::Wrapper
SESSION_NAMESPACE = 'session:gitlab'.freeze SESSION_NAMESPACE = 'session:gitlab'
USER_SESSIONS_NAMESPACE = 'session:user:gitlab'.freeze USER_SESSIONS_NAMESPACE = 'session:user:gitlab'
USER_SESSIONS_LOOKUP_NAMESPACE = 'session:lookup:user:gitlab'.freeze USER_SESSIONS_LOOKUP_NAMESPACE = 'session:lookup:user:gitlab'
IP_SESSIONS_LOOKUP_NAMESPACE = 'session:lookup:ip:gitlab'.freeze IP_SESSIONS_LOOKUP_NAMESPACE = 'session:lookup:ip:gitlab'
DEFAULT_REDIS_SHARED_STATE_URL = 'redis://localhost:6382'.freeze DEFAULT_REDIS_SHARED_STATE_URL = 'redis://localhost:6382'
REDIS_SHARED_STATE_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_SHARED_STATE_CONFIG_FILE'.freeze REDIS_SHARED_STATE_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_SHARED_STATE_CONFIG_FILE'
class << self class << self
def default_url def default_url
......
...@@ -8,8 +8,8 @@ require 'active_support/core_ext/module/delegation' ...@@ -8,8 +8,8 @@ require 'active_support/core_ext/module/delegation'
module Gitlab module Gitlab
module Redis module Redis
class Wrapper class Wrapper
DEFAULT_REDIS_URL = 'redis://localhost:6379'.freeze DEFAULT_REDIS_URL = 'redis://localhost:6379'
REDIS_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_CONFIG_FILE'.freeze REDIS_CONFIG_ENV_VAR_NAME = 'GITLAB_REDIS_CONFIG_FILE'
class << self class << self
delegate :params, :url, to: :new delegate :params, :url, to: :new
......
...@@ -4,7 +4,7 @@ require 'fileutils' ...@@ -4,7 +4,7 @@ require 'fileutils'
module Gitlab module Gitlab
module RequestProfiler module RequestProfiler
PROFILES_DIR = "#{Gitlab.config.shared.path}/tmp/requests_profiles".freeze PROFILES_DIR = "#{Gitlab.config.shared.path}/tmp/requests_profiles"
def all def all
Dir["#{PROFILES_DIR}/*.{html,txt}"].map do |path| Dir["#{PROFILES_DIR}/*.{html,txt}"].map do |path|
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
class ShardHealthCache class ShardHealthCache
HEALTHY_SHARDS_KEY = 'gitlab-healthy-shards'.freeze HEALTHY_SHARDS_KEY = 'gitlab-healthy-shards'
HEALTHY_SHARDS_TIMEOUT = 300 HEALTHY_SHARDS_TIMEOUT = 300
# Clears the Redis set storing the list of healthy shards # Clears the Redis set storing the list of healthy shards
......
...@@ -4,7 +4,7 @@ module Gitlab ...@@ -4,7 +4,7 @@ module Gitlab
class SidekiqMonitor < Daemon class SidekiqMonitor < Daemon
include ::Gitlab::Utils::StrongMemoize include ::Gitlab::Utils::StrongMemoize
NOTIFICATION_CHANNEL = 'sidekiq:cancel:notifications'.freeze NOTIFICATION_CHANNEL = 'sidekiq:cancel:notifications'
CANCEL_DEADLINE = 24.hours.seconds CANCEL_DEADLINE = 24.hours.seconds
RECONNECT_TIME = 3.seconds RECONNECT_TIME = 3.seconds
......
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
# expire after a certain period of time to prevent storing too many keys in # expire after a certain period of time to prevent storing too many keys in
# Redis. # Redis.
module SidekiqStatus module SidekiqStatus
STATUS_KEY = 'gitlab-sidekiq-status:%s'.freeze STATUS_KEY = 'gitlab-sidekiq-status:%s'
# The default time (in seconds) after which a status key is expired # The default time (in seconds) after which a status key is expired
# automatically. The default of 30 minutes should be more than sufficient # automatically. The default of 30 minutes should be more than sufficient
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module Gitlab module Gitlab
class UrlHelpers class UrlHelpers
WSS_PROTOCOL = "wss".freeze WSS_PROTOCOL = "wss"
def self.as_wss(url) def self.as_wss(url)
return unless url.present? return unless url.present?
......
...@@ -7,13 +7,13 @@ require 'uri' ...@@ -7,13 +7,13 @@ require 'uri'
module Gitlab module Gitlab
class Workhorse class Workhorse
SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data'.freeze SEND_DATA_HEADER = 'Gitlab-Workhorse-Send-Data'
VERSION_FILE = 'GITLAB_WORKHORSE_VERSION'.freeze VERSION_FILE = 'GITLAB_WORKHORSE_VERSION'
INTERNAL_API_CONTENT_TYPE = 'application/vnd.gitlab-workhorse+json'.freeze INTERNAL_API_CONTENT_TYPE = 'application/vnd.gitlab-workhorse+json'
INTERNAL_API_REQUEST_HEADER = 'Gitlab-Workhorse-Api-Request'.freeze INTERNAL_API_REQUEST_HEADER = 'Gitlab-Workhorse-Api-Request'
NOTIFICATION_CHANNEL = 'workhorse:notifications'.freeze NOTIFICATION_CHANNEL = 'workhorse:notifications'
ALLOWED_GIT_HTTP_ACTIONS = %w[git_receive_pack git_upload_pack info_refs].freeze ALLOWED_GIT_HTTP_ACTIONS = %w[git_receive_pack git_upload_pack info_refs].freeze
DETECT_HEADER = 'Gitlab-Workhorse-Detect-Content-Type'.freeze DETECT_HEADER = 'Gitlab-Workhorse-Detect-Content-Type'
# Supposedly the effective key size for HMAC-SHA256 is 256 bits, i.e. 32 # Supposedly the effective key size for HMAC-SHA256 is 256 bits, i.e. 32
# bytes https://tools.ietf.org/html/rfc4868#section-2.6 # bytes https://tools.ietf.org/html/rfc4868#section-2.6
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment