diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-05-03 10:54:12 +0300 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-05-03 10:54:12 +0300 |
commit | d39b3d4b8d2d4c5ded46182a5353c68a8f5bb5cd (patch) | |
tree | e8f2fac760b252928ff23074dea9d1f209838a33 /config | |
parent | dcb67951a817db262ddcd3b777fafc4e1995fc04 (diff) | |
parent | 2c9568edeea7d95b6e4ec3c23cdc1c027bf86d5f (diff) |
Merge branch 'master' into feature/runner-per-group
Diffstat (limited to 'config')
-rw-r--r-- | config/application.rb | 1 | ||||
-rw-r--r-- | config/gitlab.yml.example | 24 | ||||
-rw-r--r-- | config/initializers/1_settings.rb | 3 | ||||
-rw-r--r-- | config/initializers/9_fast_gettext.rb (renamed from config/initializers/fast_gettext.rb) | 0 | ||||
-rw-r--r-- | config/initializers/doorkeeper.rb | 2 | ||||
-rw-r--r-- | config/initializers/omniauth.rb | 1 | ||||
-rw-r--r-- | config/initializers/pages.rb | 2 | ||||
-rw-r--r-- | config/initializers/peek.rb | 1 | ||||
-rw-r--r-- | config/initializers/session_store.rb | 26 | ||||
-rw-r--r-- | config/initializers/warden.rb | 12 | ||||
-rw-r--r-- | config/karma.config.js | 77 | ||||
-rw-r--r-- | config/routes/profile.rb | 1 | ||||
-rw-r--r-- | config/routes/project.rb | 1 | ||||
-rw-r--r-- | config/webpack.config.js | 3 |
14 files changed, 109 insertions, 45 deletions
diff --git a/config/application.rb b/config/application.rb index ad7338763f7..09f706e3d70 100644 --- a/config/application.rb +++ b/config/application.rb @@ -115,6 +115,7 @@ module Gitlab config.assets.precompile << "test.css" config.assets.precompile << "snippets.css" config.assets.precompile << "locale/**/app.js" + config.assets.precompile << "emoji_sprites.css" # Import gitlab-svgs directly from vendored directory config.assets.paths << "#{config.root}/node_modules/@gitlab-org/gitlab-svgs/dist" diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example index 8c39a1f2aa9..7eb44b8059e 100644 --- a/config/gitlab.yml.example +++ b/config/gitlab.yml.example @@ -184,18 +184,18 @@ production: &base # base_dir: uploads/-/system object_store: enabled: false - # remote_directory: uploads # Bucket name + remote_directory: uploads # Bucket name # direct_upload: false # Use Object Storage directly for uploads instead of background uploads if enabled (Default: false) # background_upload: false # Temporary option to limit automatic upload (Default: true) # proxy_download: false # Passthrough all downloads via GitLab instead of using Redirects to Object Storage - connection: - provider: AWS - aws_access_key_id: AWS_ACCESS_KEY_ID - aws_secret_access_key: AWS_SECRET_ACCESS_KEY - region: us-east-1 - # host: 'localhost' # default: s3.amazonaws.com - # endpoint: 'http://127.0.0.1:9000' # default: nil - # path_style: true # Use 'host/bucket_name/object' instead of 'bucket_name.host/object' + connection: + provider: AWS + aws_access_key_id: AWS_ACCESS_KEY_ID + aws_secret_access_key: AWS_SECRET_ACCESS_KEY + region: us-east-1 + # host: 'localhost' # default: s3.amazonaws.com + # endpoint: 'http://127.0.0.1:9000' # default: nil + # path_style: true # Use 'host/bucket_name/object' instead of 'bucket_name.host/object' ## GitLab Pages pages: @@ -212,6 +212,8 @@ production: &base artifacts_server: true # external_http: ["1.1.1.1:80", "[2001::1]:80"] # If defined, enables custom domain support in GitLab Pages # external_https: ["1.1.1.1:443", "[2001::1]:443"] # If defined, enables custom domain and certificate support in GitLab Pages + admin: + address: unix:/home/git/gitlab/tmp/sockets/private/pages-admin.socket # TCP connections are supported too (e.g. tcp://host:port) ## Mattermost ## For enabling Add to Mattermost button @@ -532,7 +534,7 @@ production: &base # required_claims: ["name", "email"], # info_map: { name: "name", email: "email" }, # auth_url: 'https://example.com/', - # valid_within: nil, + # valid_within: null, # } # } # - { name: 'saml', @@ -823,7 +825,7 @@ test: required_claims: ["name", "email"], info_map: { name: "name", email: "email" }, auth_url: 'https://example.com/', - valid_within: nil, + valid_within: null, } } - { name: 'auth0', diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 575f27d1ea9..5248bd858a0 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -215,6 +215,9 @@ Settings.pages['external_http'] ||= false unless Settings.pages['external_ht Settings.pages['external_https'] ||= false unless Settings.pages['external_https'].present? Settings.pages['artifacts_server'] ||= Settings.pages['enabled'] if Settings.pages['artifacts_server'].nil? +Settings.pages['admin'] ||= Settingslogic.new({}) +Settings.pages.admin['certificate'] ||= '' + # # Git LFS # diff --git a/config/initializers/fast_gettext.rb b/config/initializers/9_fast_gettext.rb index fd0167aa476..fd0167aa476 100644 --- a/config/initializers/fast_gettext.rb +++ b/config/initializers/9_fast_gettext.rb diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 2079d3acb72..e3a342590d4 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -104,5 +104,5 @@ Doorkeeper.configure do # set to true if you want this to be allowed # wildcard_redirect_uri false - base_controller 'ApplicationController' + base_controller '::Gitlab::BaseDoorkeeperController' end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 00baea08613..e33ebb25c4c 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -25,5 +25,6 @@ end module OmniAuth module Strategies autoload :Bitbucket, Rails.root.join('lib', 'omni_auth', 'strategies', 'bitbucket') + autoload :Jwt, Rails.root.join('lib', 'omni_auth', 'strategies', 'jwt') end end diff --git a/config/initializers/pages.rb b/config/initializers/pages.rb new file mode 100644 index 00000000000..835197557e8 --- /dev/null +++ b/config/initializers/pages.rb @@ -0,0 +1,2 @@ +Gitlab::PagesClient.read_or_create_token +Gitlab::PagesClient.load_certificate diff --git a/config/initializers/peek.rb b/config/initializers/peek.rb index ba04a2bf5fa..bc9b52ceef7 100644 --- a/config/initializers/peek.rb +++ b/config/initializers/peek.rb @@ -1,7 +1,6 @@ Rails.application.config.peek.adapter = :redis, { client: ::Redis.new(Gitlab::Redis::Cache.params) } Peek.into Peek::Views::Host -Peek.into Peek::Views::PerformanceBar if Gitlab::Database.mysql? require 'peek-mysql2' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index f2fde1e0048..da24881885e 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -15,19 +15,15 @@ cookie_key = if Rails.env.development? "_gitlab_session" end -if Rails.env.test? - Gitlab::Application.config.session_store :cookie_store, key: "_gitlab_session" -else - sessions_config = Gitlab::Redis::SharedState.params - sessions_config[:namespace] = Gitlab::Redis::SharedState::SESSION_NAMESPACE +sessions_config = Gitlab::Redis::SharedState.params +sessions_config[:namespace] = Gitlab::Redis::SharedState::SESSION_NAMESPACE - Gitlab::Application.config.session_store( - :redis_store, # Using the cookie_store would enable session replay attacks. - servers: sessions_config, - key: cookie_key, - secure: Gitlab.config.gitlab.https, - httponly: true, - expires_in: Settings.gitlab['session_expire_delay'] * 60, - path: Rails.application.config.relative_url_root.nil? ? '/' : Gitlab::Application.config.relative_url_root - ) -end +Gitlab::Application.config.session_store( + :redis_store, # Using the cookie_store would enable session replay attacks. + servers: sessions_config, + key: cookie_key, + secure: Gitlab.config.gitlab.https, + httponly: true, + expires_in: Settings.gitlab['session_expire_delay'] * 60, + path: Rails.application.config.relative_url_root.nil? ? '/' : Gitlab::Application.config.relative_url_root +) diff --git a/config/initializers/warden.rb b/config/initializers/warden.rb index ee034d21eae..bf079f8e1a7 100644 --- a/config/initializers/warden.rb +++ b/config/initializers/warden.rb @@ -6,4 +6,16 @@ Rails.application.configure do |config| Warden::Manager.before_failure do |env, opts| Gitlab::Auth::BlockedUserTracker.log_if_user_blocked(env) end + + Warden::Manager.after_authentication do |user, auth, opts| + ActiveSession.cleanup(user) + end + + Warden::Manager.after_set_user only: :fetch do |user, auth, opts| + ActiveSession.set(user, auth.request) + end + + Warden::Manager.before_logout do |user, auth, opts| + ActiveSession.destroy(user || auth.user, auth.request.session.id) + end end diff --git a/config/karma.config.js b/config/karma.config.js index 691cda98861..3eb220eed99 100644 --- a/config/karma.config.js +++ b/config/karma.config.js @@ -1,8 +1,16 @@ -var path = require('path'); -var webpack = require('webpack'); -var argumentsParser = require('commander'); -var webpackConfig = require('./webpack.config.js'); -var ROOT_PATH = path.resolve(__dirname, '..'); +const path = require('path'); +const glob = require('glob'); +const chalk = require('chalk'); +const webpack = require('webpack'); +const argumentsParser = require('commander'); +const webpackConfig = require('./webpack.config.js'); + +const ROOT_PATH = path.resolve(__dirname, '..'); + +function fatalError(message) { + console.error(chalk.red(`\nError: ${message}\n`)); + process.exit(1); +} // remove problematic plugins if (webpackConfig.plugins) { @@ -15,33 +23,70 @@ if (webpackConfig.plugins) { }); } -var testFiles = argumentsParser +const specFilters = argumentsParser .option( '-f, --filter-spec [filter]', 'Filter run spec files by path. Multiple filters are like a logical OR.', - (val, memo) => { - memo.push(val); + (filter, memo) => { + memo.push(filter, filter.replace(/\/?$/, '/**/*.js')); return memo; }, [] ) .parse(process.argv).filterSpec; -webpackConfig.plugins.push( - new webpack.DefinePlugin({ - 'process.env.TEST_FILES': JSON.stringify(testFiles), - }) -); +if (specFilters.length) { + const specsPath = /^(?:\.[\\\/])?spec[\\\/]javascripts[\\\/]/; + + // resolve filters + let filteredSpecFiles = specFilters.map(filter => + glob + .sync(filter, { + root: ROOT_PATH, + matchBase: true, + }) + .filter(path => path.endsWith('spec.js')) + ); + + // flatten + filteredSpecFiles = Array.prototype.concat.apply([], filteredSpecFiles); + + // remove duplicates + filteredSpecFiles = [...new Set(filteredSpecFiles)]; + + if (filteredSpecFiles.length < 1) { + fatalError('Your filter did not match any test files.'); + } + + if (!filteredSpecFiles.every(file => specsPath.test(file))) { + fatalError('Test files must be located within /spec/javascripts.'); + } + + const newContext = filteredSpecFiles.reduce((context, file) => { + const relativePath = file.replace(specsPath, ''); + context[file] = `./${relativePath}`; + return context; + }, {}); + + webpackConfig.plugins.push( + new webpack.ContextReplacementPlugin( + /spec[\\\/]javascripts$/, + path.join(ROOT_PATH, 'spec/javascripts'), + newContext + ) + ); +} -webpackConfig.devtool = process.env.BABEL_ENV !== 'coverage' && 'cheap-inline-source-map'; +webpackConfig.entry = undefined; +webpackConfig.devtool = 'cheap-inline-source-map'; // Karma configuration module.exports = function(config) { process.env.TZ = 'Etc/UTC'; - var progressReporter = process.env.CI ? 'mocha' : 'progress'; + const progressReporter = process.env.CI ? 'mocha' : 'progress'; - var karmaConfig = { + const karmaConfig = { basePath: ROOT_PATH, browsers: ['ChromeHeadlessCustom'], customLaunchers: { diff --git a/config/routes/profile.rb b/config/routes/profile.rb index bcfc17a5f66..a9ba5ac2c0b 100644 --- a/config/routes/profile.rb +++ b/config/routes/profile.rb @@ -30,6 +30,7 @@ resource :profile, only: [:show, :update] do put :revoke end end + resources :active_sessions, only: [:index, :destroy] resources :emails, only: [:index, :create, :destroy] do member do put :resend_confirmation_instructions diff --git a/config/routes/project.rb b/config/routes/project.rb index 382d5b1e3c7..7fffd16f3cf 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -161,7 +161,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end get :diff_for_path - get :update_branches get :branch_from get :branch_to end diff --git a/config/webpack.config.js b/config/webpack.config.js index 39e9fbbd530..b9d098ff9b9 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -69,6 +69,9 @@ const config = { test: /\.js$/, exclude: /(node_modules|vendor\/assets)/, loader: 'babel-loader', + options: { + cacheDirectory: path.join(ROOT_PATH, 'tmp/cache/babel-loader'), + }, }, { test: /\.vue$/, |