summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMartin Wortschack <mwortschack@gitlab.com>2018-09-06 16:15:59 +0200
committerMartin Wortschack <mwortschack@gitlab.com>2018-09-06 16:15:59 +0200
commit92bbcf9079270897d419a0b4c196ac17251bf68a (patch)
tree357cdf26cf811aaddc98ccebaedb02d9575ac74b /config
parentd92b7f7ca738958add587188b4e415e4bf8fb394 (diff)
parentbac9a1dde1e75d057e212ab5d3b9b478d3981e1d (diff)
downloadgitlab-ce-92bbcf9079270897d419a0b4c196ac17251bf68a.tar.gz
merge master and resolve conflicts
Diffstat (limited to 'config')
-rw-r--r--config/dependency_decisions.yml31
-rw-r--r--config/initializers/1_settings.rb2
-rw-r--r--config/initializers/carrierwave_patch.rb29
-rw-r--r--config/initializers/fog_google_https_private_urls.rb2
-rw-r--r--config/initializers/lograge.rb3
-rw-r--r--config/initializers/mysql_set_length_for_binary_indexes.rb32
-rw-r--r--config/initializers/postgresql_opclasses_support.rb50
-rw-r--r--config/initializers/sidekiq.rb6
-rw-r--r--config/routes/group.rb1
-rw-r--r--config/routes/project.rb1
10 files changed, 124 insertions, 33 deletions
diff --git a/config/dependency_decisions.yml b/config/dependency_decisions.yml
index dce1fc1bc45..664035831a5 100644
--- a/config/dependency_decisions.yml
+++ b/config/dependency_decisions.yml
@@ -235,8 +235,9 @@
:why: https://github.com/component/inherit/blob/master/LICENSE
:versions: []
:when: 2017-01-14 20:10:41.804804000 Z
-- - :approve
+- - :license
- fsevents
+ - MIT
- :who: Matt Lee
:why: https://github.com/strongloop/fsevents/blob/master/LICENSE
:versions: []
@@ -380,8 +381,9 @@
:why: https://github.com/Tjatse/ansi-html/blob/master/LICENSE
:versions: []
:when: 2017-04-10 05:42:12.898178000 Z
-- - :approve
+- - :license
- map-stream
+ - MIT
- :who: Mike Greiling
:why: https://github.com/dominictarr/map-stream/blob/master/LICENCE
:versions: []
@@ -458,8 +460,9 @@
:why: CC0 1.0 - https://github.com/jonathantneal/svg4everybody/blob/master/LICENSE.md
:versions: []
:when: 2017-09-13 17:31:16.425819400 Z
-- - :approve
+- - :license
- "@gitlab-org/gitlab-svgs"
+ - MIT
- :who: Tim Zallmann
:why: Our own library - GitLab License https://gitlab.com/gitlab-org/gitlab-svgs
:versions: []
@@ -528,8 +531,9 @@
:why: https://github.com/mafintosh/cyclist/blob/master/LICENSE
:versions: []
:when: 2018-02-20 21:37:43.774978000 Z
-- - :approve
+- - :license
- bitsyntax
+ - MIT
- :who: Mike Greiling
:why: https://github.com/squaremo/bitsyntax-js/blob/master/LICENSE-MIT
:versions: []
@@ -540,8 +544,9 @@
:why: https://github.com/xtuc/webassemblyjs/blob/master/LICENSE
:versions: []
:when: 2018-06-08 05:30:56.764116000 Z
-- - :approve
+- - :license
- "@gitlab-org/gitlab-ui"
+ - MIT
- :who: Clement Ho
:why: Our own library
:versions: []
@@ -552,21 +557,31 @@
:why: https://github.com/pieroxy/lz-string/blob/master/LICENSE.txt
:versions: []
:when: 2018-08-03 08:22:44.973457000 Z
-- - :approve
+- - :license
- smooshpack
+ - LGPL
- :who: Phil Hughes
:why: https://github.com/CompuIves/codesandbox-client/blob/master/packages/sandpack/LICENSE.md
:versions: []
:when: 2018-08-03 08:24:29.578991000 Z
-- - :approve
+- - :license
- codesandbox-import-util-types
+ - LGPL
- :who: Phil Hughes
:why: https://github.com/codesandbox-app/codesandbox-importers/blob/master/packages/types/LICENSE
:versions: []
:when: 2018-08-03 12:22:47.574421000 Z
-- - :approve
+- - :license
- codesandbox-import-utils
+ - LGPL
- :who: Phil Hughes
:why: https://github.com/codesandbox-app/codesandbox-importers/blob/master/packages/import-utils/LICENSE
:versions: []
:when: 2018-08-03 12:23:24.083046000 Z
+- - :ignore_group
+ - devDependencies
+ - :who: Winnie Hellmann
+ :why: NPM packages used for development are not distributed with the final product
+ and are therefore exempt.
+ :versions: []
+ :when: 2018-08-30 12:06:35.668181000 Z
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb
index 9ad55e21d11..ab351b86cae 100644
--- a/config/initializers/1_settings.rb
+++ b/config/initializers/1_settings.rb
@@ -141,7 +141,7 @@ Settings.gitlab['default_projects_features'] ||= {}
Settings.gitlab['webhook_timeout'] ||= 10
Settings.gitlab['max_attachment_size'] ||= 10
Settings.gitlab['session_expire_delay'] ||= 10080
-Settings.gitlab['unauthenticated_session_expire_delay'] ||= 1.hour.to_i
+Settings.gitlab['unauthenticated_session_expire_delay'] ||= 2.hours.to_i
Settings.gitlab.default_projects_features['issues'] = true if Settings.gitlab.default_projects_features['issues'].nil?
Settings.gitlab.default_projects_features['merge_requests'] = true if Settings.gitlab.default_projects_features['merge_requests'].nil?
Settings.gitlab.default_projects_features['wiki'] = true if Settings.gitlab.default_projects_features['wiki'].nil?
diff --git a/config/initializers/carrierwave_patch.rb b/config/initializers/carrierwave_patch.rb
new file mode 100644
index 00000000000..35ffff03abe
--- /dev/null
+++ b/config/initializers/carrierwave_patch.rb
@@ -0,0 +1,29 @@
+# This monkey patches CarrierWave 1.2.3 to make Google Cloud Storage work with
+# extra query parameters:
+# https://github.com/carrierwaveuploader/carrierwave/pull/2332/files
+module CarrierWave
+ module Storage
+ class Fog < Abstract
+ class File
+ def authenticated_url(options = {})
+ if %w(AWS Google Rackspace OpenStack).include?(@uploader.fog_credentials[:provider])
+ # avoid a get by using local references
+ local_directory = connection.directories.new(key: @uploader.fog_directory)
+ local_file = local_directory.files.new(key: path)
+ expire_at = ::Fog::Time.now + @uploader.fog_authenticated_url_expiration
+ case @uploader.fog_credentials[:provider]
+ when 'AWS', 'Google'
+ local_file.url(expire_at, options)
+ when 'Rackspace'
+ connection.get_object_https_url(@uploader.fog_directory, path, expire_at, options)
+ when 'OpenStack'
+ connection.get_object_https_url(@uploader.fog_directory, path, expire_at)
+ else
+ local_file.url(expire_at)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/config/initializers/fog_google_https_private_urls.rb b/config/initializers/fog_google_https_private_urls.rb
index c65a534b536..682b1050c68 100644
--- a/config/initializers/fog_google_https_private_urls.rb
+++ b/config/initializers/fog_google_https_private_urls.rb
@@ -9,7 +9,7 @@ module Fog
module MonkeyPatch
def url(expires, options = {})
requires :key
- collection.get_https_url(key, expires)
+ collection.get_https_url(key, expires, options)
end
end
diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb
index 1cf8a24e98c..840404e0ec0 100644
--- a/config/initializers/lograge.rb
+++ b/config/initializers/lograge.rb
@@ -22,7 +22,8 @@ unless Sidekiq.server?
params: params,
remote_ip: event.payload[:remote_ip],
user_id: event.payload[:user_id],
- username: event.payload[:username]
+ username: event.payload[:username],
+ ua: event.payload[:ua]
}
gitaly_calls = Gitlab::GitalyClient.get_request_count
diff --git a/config/initializers/mysql_set_length_for_binary_indexes.rb b/config/initializers/mysql_set_length_for_binary_indexes.rb
index de0bc5322aa..81ed2fb83de 100644
--- a/config/initializers/mysql_set_length_for_binary_indexes.rb
+++ b/config/initializers/mysql_set_length_for_binary_indexes.rb
@@ -2,13 +2,17 @@
# MySQL adapter apply a length of 20. Otherwise MySQL can't create an index on
# binary columns.
+# This module can be removed once a Rails 5 schema is used.
+# It can't be wrapped in a check that checks Gitlab.rails5? because
+# the old Rails 4 schema layout is still used
module MysqlSetLengthForBinaryIndex
def add_index(table_name, column_names, options = {})
+ options[:length] ||= {}
Array(column_names).each do |column_name|
column = ActiveRecord::Base.connection.columns(table_name).find { |c| c.name == column_name }
if column&.type == :binary
- options[:length] = 20
+ options[:length][column_name] = 20
end
end
@@ -19,3 +23,29 @@ end
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
ActiveRecord::ConnectionAdapters::Mysql2Adapter.send(:prepend, MysqlSetLengthForBinaryIndex)
end
+
+if Gitlab.rails5?
+ module MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema
+ # This method is used in Rails 5 schema loading as t.index
+ def index(column_names, options = {})
+ options[:length] ||= {}
+ Array(column_names).each do |column_name|
+ column = columns.find { |c| c.name == column_name }
+
+ if column&.type == :binary
+ options[:length][column_name] = 20
+ end
+ end
+
+ # Ignore indexes that use opclasses,
+ # also see config/initializers/mysql_ignore_postgresql_options.rb
+ unless options[:opclasses]
+ super(column_names, options)
+ end
+ end
+ end
+
+ if defined?(ActiveRecord::ConnectionAdapters::MySQL::TableDefinition)
+ ActiveRecord::ConnectionAdapters::MySQL::TableDefinition.send(:prepend, MysqlSetLengthForBinaryIndexAndIgnorePostgresOptionsForSchema)
+ end
+end
diff --git a/config/initializers/postgresql_opclasses_support.rb b/config/initializers/postgresql_opclasses_support.rb
index 7b8afc78817..12a0770a455 100644
--- a/config/initializers/postgresql_opclasses_support.rb
+++ b/config/initializers/postgresql_opclasses_support.rb
@@ -144,7 +144,10 @@ module ActiveRecord
[column, opclass] if opclass
end.compact]
- IndexDefinition.new(table_name, index_name, unique, column_names, [], orders, where, nil, using, opclasses)
+ index_attrs = [table_name, index_name, unique, column_names, [], orders, where, nil, using, opclasses]
+ index_attrs.insert(-2, nil) if Gitlab.rails5? # include index comment for Rails 5
+
+ IndexDefinition.new(*index_attrs)
end
end.compact
end
@@ -172,29 +175,38 @@ module ActiveRecord
def indexes(table, stream)
if (indexes = @connection.indexes(table)).any?
add_index_statements = indexes.map do |index|
- statement_parts = [
- "add_index #{remove_prefix_and_suffix(index.table).inspect}",
- index.columns.inspect,
- "name: #{index.name.inspect}",
- ]
- statement_parts << 'unique: true' if index.unique
-
- index_lengths = (index.lengths || []).compact
- statement_parts << "length: #{Hash[index.columns.zip(index.lengths)].inspect}" if index_lengths.any?
-
- index_orders = index.orders || {}
- statement_parts << "order: #{index.orders.inspect}" if index_orders.any?
- statement_parts << "where: #{index.where.inspect}" if index.where
- statement_parts << "using: #{index.using.inspect}" if index.using
- statement_parts << "type: #{index.type.inspect}" if index.type
- statement_parts << "opclasses: #{index.opclasses}" if index.opclasses.present?
-
- " #{statement_parts.join(', ')}"
+ table_name = remove_prefix_and_suffix(index.table).inspect
+ " add_index #{([table_name]+index_parts(index)).join(', ')}"
end
stream.puts add_index_statements.sort.join("\n")
stream.puts
end
end
+
+ def indexes_in_create(table, stream)
+ if (indexes = @connection.indexes(table)).any?
+ index_statements = indexes.map do |index|
+ " t.index #{index_parts(index).join(', ')}"
+ end
+ stream.puts index_statements.sort.join("\n")
+ end
+ end
+
+ def index_parts(index)
+ index_parts = [
+ index.columns.inspect,
+ "name: #{index.name.inspect}",
+ ]
+ index_parts << "unique: true" if index.unique
+ index_parts << "length: { #{format_options(index.lengths)} }" if index.lengths.present?
+ index_parts << "order: { #{format_options(index.orders)} }" if index.orders.present?
+ index_parts << "where: #{index.where.inspect}" if index.where
+ index_parts << "using: #{index.using.inspect}" if index.using
+ index_parts << "type: #{index.type.inspect}" if index.type
+ index_parts << "opclasses: #{index.opclasses.inspect}" if index.opclasses.present?
+ index_parts << "comment: #{index.comment.inspect}" if Gitlab.rails5? && index.comment
+ index_parts
+ end
end
end
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 6f54bee4713..476eaabfed8 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -1,3 +1,9 @@
+require 'sidekiq/web'
+
+# Disable the Sidekiq Rack session since GitLab already has its own session store.
+# CSRF protection still works (https://github.com/mperham/sidekiq/commit/315504e766c4fd88a29b7772169060afc4c40329).
+Sidekiq::Web.set :sessions, false
+
# Custom Queues configuration
queues_config_hash = Gitlab::Redis::Queues.params
queues_config_hash[:namespace] = Gitlab::Redis::Queues::SIDEKIQ_NAMESPACE
diff --git a/config/routes/group.rb b/config/routes/group.rb
index d7313e43786..343865cc50c 100644
--- a/config/routes/group.rb
+++ b/config/routes/group.rb
@@ -25,7 +25,6 @@ constraints(::Constraints::GroupUrlConstrainer.new) do
constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do
namespace :settings do
resource :ci_cd, only: [:show], controller: 'ci_cd'
- resources :badges, only: [:index]
end
resource :variables, only: [:show, :update]
diff --git a/config/routes/project.rb b/config/routes/project.rb
index 34f49546983..4021d62b931 100644
--- a/config/routes/project.rb
+++ b/config/routes/project.rb
@@ -442,7 +442,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
resource :repository, only: [:show], controller: :repository do
post :create_deploy_token, path: 'deploy_token/create'
end
- resources :badges, only: [:index]
end
# Since both wiki and repository routing contains wildcard characters