summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 21:09:50 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-17 21:09:50 +0000
commiteda321fc0b96e44e296341f6288dd7f1a27ba93a (patch)
tree1dba04e1ccc485d078da441ab767e650489af112 /config
parentf1503ea64b21497db21094355ac574248dc243c4 (diff)
downloadgitlab-ce-eda321fc0b96e44e296341f6288dd7f1a27ba93a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r--config/initializers/01_secret_token.rb7
-rw-r--r--config/initializers/excon.rb8
-rw-r--r--config/initializers/sidekiq_cluster.rb29
-rw-r--r--config/plugins/monaco_webpack.js17
-rw-r--r--config/webpack.config.js57
5 files changed, 70 insertions, 48 deletions
diff --git a/config/initializers/01_secret_token.rb b/config/initializers/01_secret_token.rb
index c1f03dfdb07..bb13869c963 100644
--- a/config/initializers/01_secret_token.rb
+++ b/config/initializers/01_secret_token.rb
@@ -65,11 +65,10 @@ end
def set_missing_keys(defaults)
defaults.stringify_keys.each_with_object({}) do |(key, default), missing|
- if Rails.application.secrets[key].blank?
- warn_missing_secret(key)
+ next if Rails.application.secrets[key].present?
- missing[key] = Rails.application.secrets[key] = default
- end
+ warn_missing_secret(key)
+ missing[key] = Rails.application.secrets[key] = default
end
end
diff --git a/config/initializers/excon.rb b/config/initializers/excon.rb
new file mode 100644
index 00000000000..132cb2ff15b
--- /dev/null
+++ b/config/initializers/excon.rb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+require 'openssl'
+
+# Excon ships its own bundled certs by default. Avoid confusion
+# by using the same set that GitLab uses.
+Excon.defaults[:ssl_ca_file] = OpenSSL::X509::DEFAULT_CERT_FILE
+Excon.defaults[:ssl_verify_peer] = true
diff --git a/config/initializers/sidekiq_cluster.rb b/config/initializers/sidekiq_cluster.rb
index 2f9c1de47eb..6fd598b3e25 100644
--- a/config/initializers/sidekiq_cluster.rb
+++ b/config/initializers/sidekiq_cluster.rb
@@ -9,22 +9,23 @@ if ENV['ENABLE_SIDEKIQ_CLUSTER']
loop do
sleep(5)
+ next if Process.ppid == parent
+
# In cluster mode it's possible that the master process is SIGKILL'd. In
# this case the parent PID changes and we need to terminate ourselves.
- if Process.ppid != parent
- Process.kill(:TERM, Process.pid)
-
- # Allow sidekiq to cleanly terminate and push any running jobs back
- # into the queue. We use the configured timeout and add a small
- # grace period
- sleep(Sidekiq.options[:timeout] + 5)
-
- # Signaling the Sidekiq Pgroup as KILL is not forwarded to
- # a possible child process. In Sidekiq Cluster, all child Sidekiq
- # processes are PGROUP leaders (each process has its own pgroup).
- Process.kill(:KILL, 0)
- break
- end
+
+ Process.kill(:TERM, Process.pid)
+
+ # Allow sidekiq to cleanly terminate and push any running jobs back
+ # into the queue. We use the configured timeout and add a small
+ # grace period
+ sleep(Sidekiq.options[:timeout] + 5)
+
+ # Signaling the Sidekiq Pgroup as KILL is not forwarded to
+ # a possible child process. In Sidekiq Cluster, all child Sidekiq
+ # processes are PGROUP leaders (each process has its own pgroup).
+ Process.kill(:KILL, 0)
+ break
end
end
end
diff --git a/config/plugins/monaco_webpack.js b/config/plugins/monaco_webpack.js
deleted file mode 100644
index 01d88ca37db..00000000000
--- a/config/plugins/monaco_webpack.js
+++ /dev/null
@@ -1,17 +0,0 @@
-const { languagesArr } = require('monaco-editor-webpack-plugin/out/languages');
-
-// monaco-yaml library doesn't play so well with monaco-editor-webpack-plugin
-// so the only way to include its workers is by patching the list of languages
-// in monaco-editor-webpack-plugin and adding support for yaml workers. This is
-// a known issue in the library and this workaround was suggested here:
-// https://github.com/pengx17/monaco-yaml/issues/20
-
-const yamlLang = languagesArr.find((t) => t.label === 'yaml');
-
-yamlLang.entry = [yamlLang.entry, '../../monaco-yaml/lib/esm/monaco.contribution'];
-yamlLang.worker = {
- id: 'vs/language/yaml/yamlWorker',
- entry: '../../monaco-yaml/lib/esm/yaml.worker.js',
-};
-
-module.exports = require('monaco-editor-webpack-plugin');
diff --git a/config/webpack.config.js b/config/webpack.config.js
index 0d759de4900..545262bcb70 100644
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
@@ -19,13 +19,13 @@ const webpack = require('webpack');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const { StatsWriterPlugin } = require('webpack-stats-plugin');
const WEBPACK_VERSION = require('webpack/package.json').version;
+const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const createIncrementalWebpackCompiler = require('./helpers/incremental_webpack_compiler');
const IS_EE = require('./helpers/is_ee_env');
const IS_JH = require('./helpers/is_jh_env');
const vendorDllHash = require('./helpers/vendor_dll_hash');
-const MonacoWebpackPlugin = require('./plugins/monaco_webpack');
const GraphqlKnownOperationsPlugin = require('./plugins/graphql_known_operations_plugin');
const ROOT_PATH = path.resolve(__dirname, '..');
@@ -78,6 +78,20 @@ const incrementalCompiler = createIncrementalWebpackCompiler(
INCREMENTAL_COMPILER_TTL,
);
+const defaultJsTransformationOptions = {
+ cacheDirectory: path.join(CACHE_PATH, 'babel-loader'),
+ cacheIdentifier: [
+ process.env.BABEL_ENV || process.env.NODE_ENV || 'development',
+ webpack.version,
+ BABEL_VERSION,
+ BABEL_LOADER_VERSION,
+ // Ensure that changing supported browsers will refresh the cache
+ // in order to not pull in outdated files that import core-js
+ SUPPORTED_BROWSERS_HASH,
+ ].join('|'),
+ cacheCompression: false,
+};
+
function generateEntries() {
// generate automatic entry points
const autoEntries = {};
@@ -269,17 +283,23 @@ module.exports = {
/node_modules|vendor[\\/]assets/.test(modulePath) && !/\.vue\.js/.test(modulePath),
loader: 'babel-loader',
options: {
- cacheDirectory: path.join(CACHE_PATH, 'babel-loader'),
- cacheIdentifier: [
- process.env.BABEL_ENV || process.env.NODE_ENV || 'development',
- webpack.version,
- BABEL_VERSION,
- BABEL_LOADER_VERSION,
- // Ensure that changing supported browsers will refresh the cache
- // in order to not pull in outdated files that import core-js
- SUPPORTED_BROWSERS_HASH,
- ].join('|'),
- cacheCompression: false,
+ ...defaultJsTransformationOptions,
+ },
+ },
+ {
+ test: /\.js$/,
+ include: (modulePath) => /node_modules\/(monaco-|yaml)/.test(modulePath),
+ exclude: (modulePath) =>
+ /node_modules\/(monaco-yaml|monaco-editor\/esm\/vs\/editor\/contrib)/.test(modulePath),
+ loader: 'babel-loader',
+ options: {
+ presets: ['@babel/preset-env'],
+ plugins: [
+ '@babel/plugin-proposal-numeric-separator',
+ '@babel/plugin-syntax-dynamic-import',
+ '@babel/plugin-proposal-optional-chaining',
+ ],
+ ...defaultJsTransformationOptions,
},
},
{
@@ -473,7 +493,18 @@ module.exports = {
new VueLoaderPlugin(),
// automatically configure monaco editor web workers
- new MonacoWebpackPlugin(),
+ new MonacoWebpackPlugin({
+ customLanguages: [
+ {
+ label: 'yaml',
+ entry: 'monaco-yaml',
+ worker: {
+ id: 'monaco-yaml/yamlWorker',
+ entry: 'monaco-yaml/yaml.worker',
+ },
+ },
+ ],
+ }),
new GraphqlKnownOperationsPlugin({ filename: 'graphql_known_operations.yml' }),