diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-20 15:11:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-20 15:11:29 +0300 |
commit | 7b384a1f3d2608898318e67d11eea2914889ae81 (patch) | |
tree | af33e77d13b18a96156c69616cb09a3a4f7697c6 /config | |
parent | d46287cc16ba244720c6d5c00491944336972988 (diff) |
Add latest changes from gitlab-org/gitlab@12-3-stable
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 49 | ||||
-rw-r--r-- | config/initializers/sidekiq.rb | 14 | ||||
-rw-r--r-- | config/routes/project.rb | 8 |
3 files changed, 25 insertions, 46 deletions
diff --git a/config/application.rb b/config/application.rb index 5d7c52c5d81..c1e3b6f7a20 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,7 +13,6 @@ Bundler.require(*Rails.groups) module Gitlab class Application < Rails::Application require_dependency Rails.root.join('lib/gitlab') - require_dependency Rails.root.join('lib/gitlab/utils') require_dependency Rails.root.join('lib/gitlab/redis/wrapper') require_dependency Rails.root.join('lib/gitlab/redis/cache') require_dependency Rails.root.join('lib/gitlab/redis/queues') @@ -47,20 +46,18 @@ module Gitlab config.generators.templates.push("#{config.root}/generator_templates") - if Gitlab.ee? - ee_paths = config.eager_load_paths.each_with_object([]) do |path, memo| - ee_path = config.root.join('ee', Pathname.new(path).relative_path_from(config.root)) - memo << ee_path.to_s - end + ee_paths = config.eager_load_paths.each_with_object([]) do |path, memo| + ee_path = config.root.join('ee', Pathname.new(path).relative_path_from(config.root)) + memo << ee_path.to_s if ee_path.exist? + end - # Eager load should load CE first - config.eager_load_paths.push(*ee_paths) - config.helpers_paths.push "#{config.root}/ee/app/helpers" + # Eager load should load CE first + config.eager_load_paths.push(*ee_paths) + config.helpers_paths.push "#{config.root}/ee/app/helpers" - # Other than Ruby modules we load EE first - config.paths['lib/tasks'].unshift "#{config.root}/ee/lib/tasks" - config.paths['app/views'].unshift "#{config.root}/ee/app/views" - end + # Other than Ruby modules we load EE first + config.paths['lib/tasks'].unshift "#{config.root}/ee/lib/tasks" + config.paths['app/views'].unshift "#{config.root}/ee/app/views" # Rake tasks ignore the eager loading settings, so we need to set the # autoload paths explicitly @@ -181,18 +178,16 @@ module Gitlab config.assets.paths << "#{config.root}/node_modules/xterm/src/" config.assets.precompile << "xterm.css" - if Gitlab.ee? - %w[images javascripts stylesheets].each do |path| - config.assets.paths << "#{config.root}/ee/app/assets/#{path}" - config.assets.precompile << "jira_connect.js" - config.assets.precompile << "pages/jira_connect.css" - end + %w[images javascripts stylesheets].each do |path| + config.assets.paths << "#{config.root}/ee/app/assets/#{path}" + config.assets.precompile << "jira_connect.js" + config.assets.precompile << "pages/jira_connect.css" end # Import path for EE specific SCSS entry point # In CE it will import a noop file, in EE a functioning file # Order is important, so that the ee file takes precedence: - config.assets.paths << "#{config.root}/ee/app/assets/stylesheets/_ee" if Gitlab.ee? + config.assets.paths << "#{config.root}/ee/app/assets/stylesheets/_ee" config.assets.paths << "#{config.root}/app/assets/stylesheets/_ee" config.assets.paths << "#{config.root}/vendor/assets/javascripts/" @@ -202,15 +197,13 @@ module Gitlab # See https://gitlab.com/gitlab-org/gitlab-foss/issues/64091#note_194512508 config.assets.paths << "#{config.root}/node_modules" - if Gitlab.ee? - # Compile non-JS/CSS assets in the ee/app/assets folder by default - # Mimic sprockets-rails default: https://github.com/rails/sprockets-rails/blob/v3.2.1/lib/sprockets/railtie.rb#L84-L87 - LOOSE_EE_APP_ASSETS = lambda do |logical_path, filename| - filename.start_with?(config.root.join("ee/app/assets").to_s) && - !['.js', '.css', ''].include?(File.extname(logical_path)) - end - config.assets.precompile << LOOSE_EE_APP_ASSETS + # Compile non-JS/CSS assets in the ee/app/assets folder by default + # Mimic sprockets-rails default: https://github.com/rails/sprockets-rails/blob/v3.2.1/lib/sprockets/railtie.rb#L84-L87 + LOOSE_EE_APP_ASSETS = lambda do |logical_path, filename| + filename.start_with?(config.root.join("ee/app/assets").to_s) && + !['.js', '.css', ''].include?(File.extname(logical_path)) end + config.assets.precompile << LOOSE_EE_APP_ASSETS # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index e3505579204..20f31ff6810 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -28,18 +28,16 @@ if Rails.env.development? end enable_json_logs = Gitlab.config.sidekiq.log_format == 'json' -enable_sidekiq_memory_killer = ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS'].to_i.nonzero? -use_sidekiq_daemon_memory_killer = ENV["SIDEKIQ_DAEMON_MEMORY_KILLER"].to_i.nonzero? -use_sidekiq_legacy_memory_killer = !use_sidekiq_daemon_memory_killer +enable_sidekiq_monitor = ENV.fetch("SIDEKIQ_MONITOR_WORKER", 0).to_i.nonzero? Sidekiq.configure_server do |config| config.redis = queues_config_hash config.server_middleware do |chain| - chain.add Gitlab::SidekiqMiddleware::Monitor + chain.add Gitlab::SidekiqMiddleware::Monitor if enable_sidekiq_monitor chain.add Gitlab::SidekiqMiddleware::Metrics if Settings.monitoring.sidekiq_exporter chain.add Gitlab::SidekiqMiddleware::ArgumentsLogger if ENV['SIDEKIQ_LOG_ARGUMENTS'] && !enable_json_logs - chain.add Gitlab::SidekiqMiddleware::MemoryKiller if enable_sidekiq_memory_killer && use_sidekiq_legacy_memory_killer + chain.add Gitlab::SidekiqMiddleware::MemoryKiller if ENV['SIDEKIQ_MEMORY_KILLER_MAX_RSS'] chain.add Gitlab::SidekiqMiddleware::RequestStoreMiddleware unless ENV['SIDEKIQ_REQUEST_STORE'] == '0' chain.add Gitlab::SidekiqMiddleware::BatchLoader chain.add Gitlab::SidekiqMiddleware::CorrelationLogger @@ -62,11 +60,7 @@ Sidekiq.configure_server do |config| # Sidekiq (e.g. in an initializer). ActiveRecord::Base.clear_all_connections! - # Start monitor to track running jobs. By default, cancel job is not enabled - # To cancel job, it requires `SIDEKIQ_MONITOR_WORKER=1` to enable notification channel - Gitlab::SidekiqDaemon::Monitor.instance.start - - Gitlab::SidekiqDaemon::MemoryKiller.instance.start if enable_sidekiq_memory_killer && use_sidekiq_daemon_memory_killer + Gitlab::SidekiqDaemon::Monitor.instance.start if enable_sidekiq_monitor end if enable_reliable_fetch? diff --git a/config/routes/project.rb b/config/routes/project.rb index 5225cd5b054..c1273db8ee5 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -37,8 +37,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do scope '-' do get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' - resources :artifacts, only: [:index, :destroy] - resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do collection do resources :artifacts, only: [] do @@ -197,12 +195,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do defaults: { format: 'json' }, constraints: { key: %r{[^/]+}, template_type: %r{issue|merge_request}, format: 'json' } - get '/description_templates/names/:template_type', - to: 'templates#names', - as: :template_names, - defaults: { format: 'json' }, - constraints: { template_type: %r{issue|merge_request}, format: 'json' } - resources :commit, only: [:show], constraints: { id: /\h{7,40}/ } do member do get :branches |