diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-07 10:27:52 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-06-07 10:27:52 +0200 |
commit | dbb3c28088b63c8cf40a90c599b6eedb4dfbbb66 (patch) | |
tree | 9e6c4d495e45355ef62c56c0c3e102f95220f89f /config | |
parent | a924152219c1367bf494f3f387d050ac3ff2d7d3 (diff) | |
parent | dddc54aa0aea4088e5a233d18a62cb2435590fe9 (diff) | |
download | gitlab-ce-dbb3c28088b63c8cf40a90c599b6eedb4dfbbb66.tar.gz |
Merge remote-tracking branch 'upstream/master' into 28717-additional-metrics-review-branch
# Conflicts:
# app/models/project_services/prometheus_service.rb
# app/views/projects/services/_form.html.haml
Diffstat (limited to 'config')
-rw-r--r-- | config/gitlab.yml.example | 4 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 2 | ||||
-rw-r--r-- | config/initializers/active_record_locking.rb (renamed from config/initializers/ar_monkey_patch.rb) | 0 | ||||
-rw-r--r-- | config/initializers/active_record_preloader.rb | 15 | ||||
-rw-r--r-- | config/initializers/ar_speed_up_migration_checking.rb | 2 | ||||
-rw-r--r-- | config/initializers/forbid_sidekiq_in_transactions.rb | 49 | ||||
-rw-r--r-- | config/initializers/relative_naming_ci_namespace.rb | 2 | ||||
-rw-r--r-- | config/initializers/session_store.rb | 8 | ||||
-rw-r--r-- | config/karma.config.js | 2 | ||||
-rw-r--r-- | config/locales/en.yml | 36 | ||||
-rw-r--r-- | config/locales/es.yml | 35 | ||||
-rw-r--r-- | config/routes/admin.rb | 4 | ||||
-rw-r--r-- | config/routes/project.rb | 57 | ||||
-rw-r--r-- | config/webpack.config.js | 17 |
14 files changed, 195 insertions, 38 deletions
diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index a727f7e2fa3..d2aeb66ebf6 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -169,7 +169,7 @@ production: &base ## Gravatar ## For Libravatar see: http://doc.gitlab.com/ce/customization/libravatar.html gravatar: - # gravatar urls: possible placeholders: %{hash} %{size} %{email} + # gravatar urls: possible placeholders: %{hash} %{size} %{email} %{username} # plain_url: "http://..." # default: http://www.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon # ssl_url: "https://..." # default: https://secure.gravatar.com/avatar/%{hash}?s=%{size}&d=identicon @@ -449,7 +449,7 @@ production: &base # This setting controls whether GitLab uses Gitaly (new component # introduced in 9.0). Eventually Gitaly use will become mandatory and # this option will disappear. - enabled: false + enabled: true # # 4. Advanced settings diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 4fb4baf631f..45ea2040d23 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -482,7 +482,7 @@ Settings.rack_attack.git_basic_auth['bantime'] ||= 1.hour # Gitaly # Settings['gitaly'] ||= Settingslogic.new({}) -Settings.gitaly['enabled'] ||= false +Settings.gitaly['enabled'] = true if Settings.gitaly['enabled'].nil? # # Webpack settings diff --git a/config/initializers/ar_monkey_patch.rb b/config/initializers/active_record_locking.rb index 9266ff0f615..9266ff0f615 100644 --- a/config/initializers/ar_monkey_patch.rb +++ b/config/initializers/active_record_locking.rb diff --git a/config/initializers/active_record_preloader.rb b/config/initializers/active_record_preloader.rb new file mode 100644 index 00000000000..3b16014f302 --- /dev/null +++ b/config/initializers/active_record_preloader.rb @@ -0,0 +1,15 @@ +module ActiveRecord + module Associations + class Preloader + module NoCommitPreloader + def preloader_for(reflection, owners, rhs_klass) + return NullPreloader if rhs_klass == ::Commit + + super + end + end + + prepend NoCommitPreloader + end + end +end diff --git a/config/initializers/ar_speed_up_migration_checking.rb b/config/initializers/ar_speed_up_migration_checking.rb index 1fe5defc01d..aae774daa35 100644 --- a/config/initializers/ar_speed_up_migration_checking.rb +++ b/config/initializers/ar_speed_up_migration_checking.rb @@ -10,7 +10,7 @@ if Rails.env.test? # it reads + parses `db/migrate/*` each time. Memoizing it can save 0.5 # seconds per spec. def migrations(paths) - @migrations ||= migrations_unmemoized(paths) + (@migrations ||= migrations_unmemoized(paths)).dup end end end diff --git a/config/initializers/forbid_sidekiq_in_transactions.rb b/config/initializers/forbid_sidekiq_in_transactions.rb new file mode 100644 index 00000000000..a78711fe599 --- /dev/null +++ b/config/initializers/forbid_sidekiq_in_transactions.rb @@ -0,0 +1,49 @@ +module Sidekiq + module Worker + mattr_accessor :skip_transaction_check + self.skip_transaction_check = false + + def self.skipping_transaction_check(&block) + skip_transaction_check = self.skip_transaction_check + self.skip_transaction_check = true + yield + ensure + self.skip_transaction_check = skip_transaction_check + end + + module ClassMethods + module NoSchedulingFromTransactions + NESTING = ::Rails.env.test? ? 1 : 0 + + %i(perform_async perform_at perform_in).each do |name| + define_method(name) do |*args| + return super(*args) if Sidekiq::Worker.skip_transaction_check + return super(*args) unless ActiveRecord::Base.connection.open_transactions > NESTING + + raise <<-MSG.strip_heredoc + `#{self}.#{name}` cannot be called inside a transaction as this can lead to + race conditions when the worker runs before the transaction is committed and + tries to access a model that has not been saved yet. + + Use an `after_commit` hook, or include `AfterCommitQueue` and use a `run_after_commit` block instead. + MSG + end + end + end + + prepend NoSchedulingFromTransactions + end + end +end + +module ActiveRecord + class Base + module SkipTransactionCheckAfterCommit + def committed!(*) + Sidekiq::Worker.skipping_transaction_check { super } + end + end + + prepend SkipTransactionCheckAfterCommit + end +end diff --git a/config/initializers/relative_naming_ci_namespace.rb b/config/initializers/relative_naming_ci_namespace.rb index 59abe1b9b91..03ac55be0b6 100644 --- a/config/initializers/relative_naming_ci_namespace.rb +++ b/config/initializers/relative_naming_ci_namespace.rb @@ -4,7 +4,7 @@ # - [project.namespace, project, build] # # instead of: -# - namespace_project_build_path(project.namespace, project, build) +# - namespace_project_job_path(project.namespace, project, build) # # Without that, Ci:: namespace is used for resolving routes: # - namespace_project_ci_build_path(project.namespace, project, build) diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 70be2617cab..8919f7640fe 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -10,6 +10,12 @@ rescue Settings.gitlab['session_expire_delay'] ||= 10080 end +cookie_key = if Rails.env.development? + "_gitlab_session_#{Digest::SHA256.hexdigest(Rails.root.to_s)}" + else + "_gitlab_session" + end + if Rails.env.test? Gitlab::Application.config.session_store :cookie_store, key: "_gitlab_session" else @@ -19,7 +25,7 @@ else Gitlab::Application.config.session_store( :redis_store, # Using the cookie_store would enable session replay attacks. servers: redis_config, - key: '_gitlab_session', + key: cookie_key, secure: Gitlab.config.gitlab.https, httponly: true, expires_in: Settings.gitlab['session_expire_delay'] * 60, diff --git a/config/karma.config.js b/config/karma.config.js index eb082dd28bf..40c58e7771d 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -13,6 +13,8 @@ if (webpackConfig.plugins) { }); } +webpackConfig.devtool = 'cheap-inline-source-map'; + // Karma configuration module.exports = function(config) { var progressReporter = process.env.CI ? 'mocha' : 'progress'; diff --git a/config/locales/en.yml b/config/locales/en.yml index 12a59be79f0..9d47425950a 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -13,3 +13,39 @@ en: pagination: previous: "Prev" next: "Next" + datetime: + time_ago_in_words: + half_a_minute: "half a minute ago" + less_than_x_seconds: + one: "less than 1 second ago" + other: "less than %{count} seconds ago" + x_seconds: + one: "1 second ago" + other: "%{count} seconds ago" + less_than_x_minutes: + one: "less than a minute ago" + other: "less than %{count} minutes ago" + x_minutes: + one: "1 minute ago" + other: "%{count} minutes ago" + about_x_hours: + one: "about 1 hour ago" + other: "about %{count} hours ago" + x_days: + one: "1 day ago" + other: "%{count} days ago" + about_x_months: + one: "about 1 month ago" + other: "about %{count} months ago" + x_months: + one: "1 month ago" + other: "%{count} months ago" + about_x_years: + one: "about 1 year ago" + other: "about %{count} years ago" + over_x_years: + one: "over 1 year ago" + other: "over %{count} years ago" + almost_x_years: + one: "almost 1 year ago" + other: "almost %{count} years ago" diff --git a/config/locales/es.yml b/config/locales/es.yml index 87e79beee74..0f9dc39535d 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -61,6 +61,41 @@ es: - :month - :year datetime: + time_ago_in_words: + half_a_minute: "hace medio minuto" + less_than_x_seconds: + one: "hace menos de 1 segundo" + other: "hace menos de %{count} segundos" + x_seconds: + one: "hace 1 segundo" + other: "hace %{count} segundos" + less_than_x_minutes: + one: "hace menos de un minuto" + other: "hace menos de %{count} minutos" + x_minutes: + one: "hace 1 minuto" + other: "hace %{count} minutos" + about_x_hours: + one: "hace alrededor de 1 hora" + other: "hace alrededor de %{count} horas" + x_days: + one: "hace un día" + other: "hace %{count} días" + about_x_months: + one: "hace alrededor de 1 mes" + other: "hace alrededor de %{count} meses" + x_months: + one: "hace 1 mes" + other: "hace %{count} meses" + about_x_years: + one: "hace alrededor de 1 año" + other: "hace alrededor de %{count} años" + over_x_years: + one: "hace más de 1 año" + other: "hace %{count} años" + almost_x_years: + one: "hace casi 1 año" + other: "hace casi %{count} años" distance_in_words: about_x_hours: one: alrededor de 1 hora diff --git a/config/routes/admin.rb b/config/routes/admin.rb index c20581b1333..c7b639b7b3c 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -72,6 +72,8 @@ namespace :admin do resource :system_info, controller: 'system_info', only: [:show] resources :requests_profiles, only: [:index, :show], param: :name, constraints: { name: /.+\.html/ } + get 'conversational_development_index' => 'conversational_development_index#show' + resources :projects, only: [:index] scope(path: 'projects/*namespace_id', @@ -118,7 +120,7 @@ namespace :admin do resources :cohorts, only: :index - resources :builds, only: :index do + resources :jobs, only: :index do collection do post :cancel_all end diff --git a/config/routes/project.rb b/config/routes/project.rb index 6922f8db795..10ed32a3a33 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -1,4 +1,5 @@ require 'constraints/project_url_constrainer' +require 'gitlab/routes/legacy_builds' resources :projects, only: [:index, :new, :create] @@ -66,7 +67,7 @@ constraints(ProjectUrlConstrainer.new) do resources :services, constraints: { id: /[^\/]+/ }, only: [:index, :edit, :update] do member do - get :test + put :test end end @@ -186,38 +187,42 @@ constraints(ProjectUrlConstrainer.new) do end end - resources :builds, only: [:index, :show], constraints: { id: /\d+/ } do - collection do - post :cancel_all - - resources :artifacts, only: [] do - collection do - get :latest_succeeded, - path: '*ref_name_and_path', - format: false + scope '-' do + resources :jobs, only: [:index, :show], constraints: { id: /\d+/ } do + collection do + post :cancel_all + + resources :artifacts, only: [] do + collection do + get :latest_succeeded, + path: '*ref_name_and_path', + format: false + end end end - end - member do - get :status - post :cancel - post :retry - post :play - post :erase - get :trace, defaults: { format: 'json' } - get :raw - end + member do + get :status + post :cancel + post :retry + post :play + post :erase + get :trace, defaults: { format: 'json' } + get :raw + end - resource :artifacts, only: [] do - get :download - get :browse, path: 'browse(/*path)', format: false - get :file, path: 'file/*path', format: false - get :raw, path: 'raw/*path', format: false - post :keep + resource :artifacts, only: [] do + get :download + get :browse, path: 'browse(/*path)', format: false + get :file, path: 'file/*path', format: false + get :raw, path: 'raw/*path', format: false + post :keep + end end end + Gitlab::Routes::LegacyBuilds.new(self).draw + resources :hooks, only: [:index, :create, :edit, :update, :destroy], constraints: { id: /\d+/ } do member do get :test diff --git a/config/webpack.config.js b/config/webpack.config.js index 38769f3f625..a49f02d7ae8 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -16,6 +16,7 @@ var DEV_SERVER_HOST = process.env.DEV_SERVER_HOST || 'localhost'; var DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808; var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false'; var WEBPACK_REPORT = process.env.WEBPACK_REPORT; +var NO_COMPRESSION = process.env.NO_COMPRESSION; var config = { // because sqljs requires fs. @@ -41,6 +42,7 @@ var config = { group: './group.js', groups_list: './groups_list.js', issue_show: './issue_show/index.js', + integrations: './integrations', locale: './locale/index.js', main: './main.js', merge_conflicts: './merge_conflicts/merge_conflicts_bundle.js', @@ -75,8 +77,6 @@ var config = { chunkFilename: IS_PRODUCTION ? '[name].[chunkhash].chunk.js' : '[name].chunk.js', }, - devtool: 'cheap-module-source-map', - module: { rules: [ { @@ -223,11 +223,18 @@ if (IS_PRODUCTION) { }), new webpack.DefinePlugin({ 'process.env': { NODE_ENV: JSON.stringify('production') } - }), - new CompressionPlugin({ - asset: '[path].gz[query]', }) ); + + // zopfli requires a lot of compute time and is disabled in CI + if (!NO_COMPRESSION) { + config.plugins.push( + new CompressionPlugin({ + asset: '[path].gz[query]', + algorithm: 'zopfli', + }) + ); + } } if (IS_DEV_SERVER) { |