summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-03-16 18:18:33 +0000
commitf64a639bcfa1fc2bc89ca7db268f594306edfd7c (patch)
treea2c3c2ebcc3b45e596949db485d6ed18ffaacfa1 /scripts
parentbfbc3e0d6583ea1a91f627528bedc3d65ba4b10f (diff)
downloadgitlab-ce-f64a639bcfa1fc2bc89ca7db268f594306edfd7c.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc40
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/flaky_examples/prune-old-flaky-examples9
-rw-r--r--scripts/frontend/block_dependencies.js8
-rwxr-xr-xscripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js2
-rwxr-xr-xscripts/frontend/execute-on-staged-files.sh25
-rw-r--r--scripts/frontend/extract_gettext_all.js39
-rwxr-xr-xscripts/frontend/file_test_coverage.js44
-rw-r--r--scripts/frontend/frontend_script_utils.js20
-rw-r--r--scripts/frontend/merge_coverage_frontend.js13
-rw-r--r--scripts/frontend/parallel_ci_sequencer.js24
-rw-r--r--scripts/frontend/prettier.js121
-rw-r--r--scripts/frontend/stylelint/stylelint-duplicate-selectors.js6
-rw-r--r--scripts/frontend/stylelint/stylelint-utility-classes.js5
-rw-r--r--scripts/frontend/stylelint/stylelint-utility-map.js30
-rw-r--r--scripts/frontend/stylelint/stylelint-utils.js11
-rwxr-xr-xscripts/frontend/webpack_dev_server.js12
-rwxr-xr-xscripts/lint-doc.sh8
-rw-r--r--scripts/review_apps/base-config.yaml20
-rwxr-xr-xscripts/review_apps/review-apps.sh2
-rwxr-xr-xscripts/static-analysis7
-rwxr-xr-xscripts/update-workhorse59
-rwxr-xr-xscripts/validate_migration_schema2
-rwxr-xr-xscripts/verify-tff-mapping6
22 files changed, 162 insertions, 311 deletions
diff --git a/scripts/flaky_examples/prune-old-flaky-examples b/scripts/flaky_examples/prune-old-flaky-examples
index 8c09c4cc860..a5b50a7e8ea 100755
--- a/scripts/flaky_examples/prune-old-flaky-examples
+++ b/scripts/flaky_examples/prune-old-flaky-examples
@@ -1,16 +1,11 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
-# lib/rspec_flaky/flaky_examples_collection.rb is requiring
+# tooling/rspec_flaky/flaky_examples_collection.rb is requiring
# `active_support/hash_with_indifferent_access`, and we install the `activesupport`
# gem manually on the CI
require 'rubygems'
-
-# In newer Ruby, alias_method is not private then we don't need __send__
-singleton_class.__send__(:alias_method, :require_dependency, :require) # rubocop:disable GitlabSecurity/PublicSend
-$:.unshift(File.expand_path('../../lib', __dir__))
-
-require 'rspec_flaky/report'
+require_relative '../../tooling/rspec_flaky/report'
report_file = ARGV.shift
unless report_file
diff --git a/scripts/frontend/block_dependencies.js b/scripts/frontend/block_dependencies.js
index a1ff8d5ee36..f229f317cbb 100644
--- a/scripts/frontend/block_dependencies.js
+++ b/scripts/frontend/block_dependencies.js
@@ -1,8 +1,8 @@
-const path = require('path');
-const packageJson = require(path.join(process.cwd(), 'package.json'));
+const packageJson = require('../../package.json');
+
const blockedDependencies = packageJson.blockedDependencies || {};
-const dependencies = packageJson.dependencies;
-const devDependencies = packageJson.devDependencies;
+const { dependencies } = packageJson;
+const { devDependencies } = packageJson;
const blockedDependenciesNames = Object.keys(blockedDependencies);
const blockedDependenciesFound = blockedDependenciesNames.filter(
(blockedDependency) => dependencies[blockedDependency] || devDependencies[blockedDependency],
diff --git a/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js b/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js
index 34e939e3ceb..22a4aac762b 100755
--- a/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js
+++ b/scripts/frontend/check_page_bundle_mixins_css_for_sideeffects.js
@@ -7,9 +7,9 @@ if (process.env.RAILS_ENV !== 'production') {
process.exit(0);
}
-const path = require('path');
const fs = require('fs');
const glob = require('glob');
+const path = require('path');
const pjs = require('postcss');
const paths = glob.sync('public/assets/page_bundles/_mixins_and_variables_and_functions*.css', {
diff --git a/scripts/frontend/execute-on-staged-files.sh b/scripts/frontend/execute-on-staged-files.sh
new file mode 100755
index 00000000000..f218926f098
--- /dev/null
+++ b/scripts/frontend/execute-on-staged-files.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+set -euo pipefail
+IFS=$'\n\t'
+
+# The yarn run command we'd like to run
+command="$1"
+# The file types we'd like to target, use something like '(js|vue)'
+file_types="$2"
+
+# Removing first two arguments
+shift
+shift
+
+# Read all staged non-deleted files into an array
+staged_files=()
+while IFS= read -r line; do
+ staged_files+=( "$line" )
+done < <( git diff --diff-filter=d --cached --name-only | { grep -E ".$file_types$" || true; })
+
+if [ "${#staged_files[@]}" == "0" ]; then
+ echo "No staged '$file_types' files"
+else
+ echo "Running $command on ${#staged_files[@]} staged '$file_types' files"
+ yarn run "$command" "$@" "${staged_files[@]}"
+fi
diff --git a/scripts/frontend/extract_gettext_all.js b/scripts/frontend/extract_gettext_all.js
index 67163a601bc..896790a73bb 100644
--- a/scripts/frontend/extract_gettext_all.js
+++ b/scripts/frontend/extract_gettext_all.js
@@ -5,6 +5,7 @@ const {
decorateJSParserWithVueSupport,
decorateExtractorWithHelpers,
} = require('gettext-extractor-vue');
+const vue2TemplateCompiler = require('vue-template-compiler');
const ensureSingleLine = require('../../app/assets/javascripts/locale/ensure_single_line.js');
const args = argumentsParser
@@ -37,12 +38,12 @@ const jsParser = extractor.createJsParser([
]);
const vueParser = decorateJSParserWithVueSupport(jsParser, {
- vue2TemplateCompiler: require('vue-template-compiler'),
+ vue2TemplateCompiler,
});
function printJson() {
- const messages = extractor.getMessages().reduce((result, message) => {
- let text = message.text;
+ const messages = extractor.getMessages().reduce((acc, message) => {
+ let { text } = message;
if (message.textPlural) {
text += `\u0000${message.textPlural}`;
}
@@ -50,25 +51,35 @@ function printJson() {
message.references.forEach((reference) => {
const filename = reference.replace(/:\d+$/, '');
- if (!Array.isArray(result[filename])) {
- result[filename] = [];
+ if (!Array.isArray(acc[filename])) {
+ acc[filename] = [];
}
- result[filename].push([text, reference]);
+ acc[filename].push([text, reference]);
});
- return result;
+ return acc;
}, {});
console.log(JSON.stringify(messages));
}
-if (args.file) {
- vueParser.parseFile(args.file).then(() => printJson());
-} else if (args.all) {
- vueParser.parseFilesGlob('{ee/app,app}/assets/javascripts/**/*.{js,vue}').then(() => printJson());
-} else {
- console.warn('ERROR: Please use the script correctly:');
+async function main() {
+ if (args.file) {
+ return vueParser.parseFile(args.file).then(() => printJson());
+ }
+
+ if (args.all) {
+ return vueParser
+ .parseFilesGlob('{ee/app,app}/assets/javascripts/**/*.{js,vue}')
+ .then(() => printJson());
+ }
+
+ throw new Error('ERROR: Please use the script correctly:');
+}
+
+main().catch((error) => {
+ console.warn(error.message);
args.outputHelp();
process.exit(1);
-}
+});
diff --git a/scripts/frontend/file_test_coverage.js b/scripts/frontend/file_test_coverage.js
index ec6ec4a1e9d..04a9035fce2 100755
--- a/scripts/frontend/file_test_coverage.js
+++ b/scripts/frontend/file_test_coverage.js
@@ -31,28 +31,6 @@ let numTestFiles = 0;
const isVerbose = process.argv.some((arg) => arg === '-v');
-const countSourceFiles = (path) =>
- forEachFileIn(path, (fileName) => {
- if (fileName.endsWith('.vue') || fileName.endsWith('.js')) {
- if (isVerbose) {
- console.log(`source file: ${fileName}`);
- }
-
- numSourceFiles += 1;
- }
- });
-
-const countTestFiles = (path) =>
- forEachFileIn(path, (fileName) => {
- if (fileName.endsWith('_spec.js')) {
- if (isVerbose) {
- console.log(`test file: ${fileName}`);
- }
-
- numTestFiles += 1;
- }
- });
-
function forEachFileIn(dirPath, callback) {
fs.readdir(dirPath, (err, files) => {
if (err) {
@@ -75,6 +53,28 @@ function forEachFileIn(dirPath, callback) {
});
}
+const countSourceFiles = (currentPath) =>
+ forEachFileIn(currentPath, (fileName) => {
+ if (fileName.endsWith('.vue') || fileName.endsWith('.js')) {
+ if (isVerbose) {
+ console.log(`source file: ${fileName}`);
+ }
+
+ numSourceFiles += 1;
+ }
+ });
+
+const countTestFiles = (currentPath) =>
+ forEachFileIn(currentPath, (fileName) => {
+ if (fileName.endsWith('_spec.js')) {
+ if (isVerbose) {
+ console.log(`test file: ${fileName}`);
+ }
+
+ numTestFiles += 1;
+ }
+ });
+
console.log(`Source directories: ${sourceDirectories.join(', ')}`);
console.log(`Test directories: ${testDirectories.join(', ')}`);
diff --git a/scripts/frontend/frontend_script_utils.js b/scripts/frontend/frontend_script_utils.js
deleted file mode 100644
index 43016dce6a4..00000000000
--- a/scripts/frontend/frontend_script_utils.js
+++ /dev/null
@@ -1,20 +0,0 @@
-const execFileSync = require('child_process').execFileSync;
-
-const exec = (command, args) => {
- const options = {
- cwd: process.cwd(),
- env: process.env,
- encoding: 'utf-8',
- };
- return execFileSync(command, args, options);
-};
-
-const execGitCmd = (args) => exec('git', args).trim().toString().split('\n').filter(Boolean);
-
-module.exports = {
- getStagedFiles: (fileExtensionFilter) => {
- const gitOptions = ['diff', '--name-only', '--cached', '--diff-filter=ACMRTUB'];
- if (fileExtensionFilter) gitOptions.push(...fileExtensionFilter);
- return execGitCmd(gitOptions);
- },
-};
diff --git a/scripts/frontend/merge_coverage_frontend.js b/scripts/frontend/merge_coverage_frontend.js
index 0c45a38b9b5..6b3826ddac7 100644
--- a/scripts/frontend/merge_coverage_frontend.js
+++ b/scripts/frontend/merge_coverage_frontend.js
@@ -1,8 +1,8 @@
-const { create } = require('istanbul-reports');
+const { sync } = require('glob');
const { createCoverageMap } = require('istanbul-lib-coverage');
const { createContext } = require('istanbul-lib-report');
+const { create } = require('istanbul-reports');
const { resolve } = require('path');
-const { sync } = require('glob');
const coverageMap = createCoverageMap();
@@ -12,7 +12,7 @@ const reportFiles = sync(`${coverageDir}/*/coverage-final.json`);
// Normalize coverage report generated by jest that has additional "data" key
// https://github.com/facebook/jest/issues/2418#issuecomment-423806659
const normalizeReport = (report) => {
- const normalizedReport = Object.assign({}, report);
+ const normalizedReport = { ...report };
Object.entries(normalizedReport).forEach(([k, v]) => {
if (v.data) normalizedReport[k] = v.data;
});
@@ -20,11 +20,14 @@ const normalizeReport = (report) => {
};
reportFiles
- .map((reportFile) => require(reportFile))
+ .map((reportFile) => {
+ // eslint-disable-next-line global-require, import/no-dynamic-require
+ return require(reportFile);
+ })
.map(normalizeReport)
.forEach((report) => coverageMap.merge(report));
-const context = createContext({ coverageMap: coverageMap, dir: 'coverage-frontend' });
+const context = createContext({ coverageMap, dir: 'coverage-frontend' });
['json', 'lcov', 'text-summary', 'clover', 'cobertura'].forEach((reporter) => {
create(reporter, {}).execute(context);
diff --git a/scripts/frontend/parallel_ci_sequencer.js b/scripts/frontend/parallel_ci_sequencer.js
index d7a674535a6..262e9e2256e 100644
--- a/scripts/frontend/parallel_ci_sequencer.js
+++ b/scripts/frontend/parallel_ci_sequencer.js
@@ -1,5 +1,15 @@
const Sequencer = require('@jest/test-sequencer').default;
+const sortByPath = (test1, test2) => {
+ if (test1.path < test2.path) {
+ return -1;
+ }
+ if (test1.path > test2.path) {
+ return 1;
+ }
+ return 0;
+};
+
class ParallelCISequencer extends Sequencer {
constructor() {
super();
@@ -8,7 +18,7 @@ class ParallelCISequencer extends Sequencer {
}
sort(tests) {
- const sortedTests = this.sortByPath(tests);
+ const sortedTests = [...tests].sort(sortByPath);
const testsForThisRunner = this.distributeAcrossCINodes(sortedTests);
console.log(`CI_NODE_INDEX: ${this.ciNodeIndex}`);
@@ -19,18 +29,6 @@ class ParallelCISequencer extends Sequencer {
return testsForThisRunner;
}
- sortByPath(tests) {
- return tests.sort((test1, test2) => {
- if (test1.path < test2.path) {
- return -1;
- }
- if (test1.path > test2.path) {
- return 1;
- }
- return 0;
- });
- }
-
distributeAcrossCINodes(tests) {
return tests.filter((test, index) => {
return index % this.ciNodeTotal === this.ciNodeIndex - 1;
diff --git a/scripts/frontend/prettier.js b/scripts/frontend/prettier.js
deleted file mode 100644
index f721e46f36b..00000000000
--- a/scripts/frontend/prettier.js
+++ /dev/null
@@ -1,121 +0,0 @@
-const glob = require('glob');
-const prettier = require('prettier');
-const fs = require('fs');
-const { getStagedFiles } = require('./frontend_script_utils');
-
-const matchExtensions = ['js', 'vue', 'graphql'];
-
-// This will improve glob performance by excluding certain directories.
-// The .prettierignore file will also be respected, but after the glob has executed.
-const globIgnore = ['**/node_modules/**', 'vendor/**', 'public/**', 'fixtures/**'];
-
-const readFileAsync = (file, options) =>
- new Promise((resolve, reject) => {
- fs.readFile(file, options, function (err, data) {
- if (err) reject(err);
- else resolve(data);
- });
- });
-
-const writeFileAsync = (file, data, options) =>
- new Promise((resolve, reject) => {
- fs.writeFile(file, data, options, function (err) {
- if (err) reject(err);
- else resolve();
- });
- });
-
-const mode = process.argv[2] || 'check';
-const shouldSave = mode === 'save' || mode === 'save-all';
-const allFiles = mode === 'check-all' || mode === 'save-all';
-let globDir = process.argv[3] || '';
-if (globDir && globDir.charAt(globDir.length - 1) !== '/') globDir += '/';
-
-console.log(
- `Loading all ${allFiles ? '' : 'staged '}files ${globDir ? `within ${globDir} ` : ''}...`,
-);
-
-const globPatterns = matchExtensions.map((ext) => `${globDir}**/*.${ext}`);
-const matchedFiles = allFiles
- ? glob.sync(`{${globPatterns.join(',')}}`, { ignore: globIgnore })
- : getStagedFiles(globPatterns);
-const matchedCount = matchedFiles.length;
-
-if (!matchedCount) {
- console.log('No files found to process with prettier');
- process.exit(0);
-}
-
-let didWarn = false;
-let passedCount = 0;
-let failedCount = 0;
-let ignoredCount = 0;
-
-console.log(`${shouldSave ? 'Updating' : 'Checking'} ${matchedCount} file(s)`);
-
-const fixCommand = `yarn prettier-${allFiles ? 'all' : 'staged'}-save`;
-const warningMessage = `
-===============================
-GitLab uses Prettier to format all JavaScript code.
-Please format each file listed below or run "${fixCommand}"
-===============================
-`;
-
-const checkFileWithOptions = (filePath, options) =>
- readFileAsync(filePath, 'utf8').then((input) => {
- if (shouldSave) {
- const output = prettier.format(input, options);
- if (input === output) {
- passedCount += 1;
- } else {
- return writeFileAsync(filePath, output, 'utf8').then(() => {
- console.log(`Prettified : ${filePath}`);
- failedCount += 1;
- });
- }
- } else {
- if (prettier.check(input, options)) {
- passedCount += 1;
- } else {
- if (!didWarn) {
- // \x1b[31m make text red
- // \x1b[1m make text bold
- // %s warningMessage
- // \x1b[0m reset text color (so logs after aren't red)
- const redBoldText = '\x1b[1m\x1b[31;1m%s\x1b[0m';
- console.log(redBoldText, warningMessage);
- didWarn = true;
- }
- console.log(`yarn prettier --write ${filePath}`);
- failedCount += 1;
- }
- }
- });
-
-const checkFileWithPrettierConfig = (filePath) =>
- prettier
- .getFileInfo(filePath, { ignorePath: '.prettierignore' })
- .then(({ ignored, inferredParser }) => {
- if (ignored || !inferredParser) {
- ignoredCount += 1;
- return;
- }
- return prettier.resolveConfig(filePath).then((fileOptions) => {
- const options = { ...fileOptions, parser: inferredParser };
- return checkFileWithOptions(filePath, options);
- });
- });
-
-Promise.all(matchedFiles.map(checkFileWithPrettierConfig))
- .then(() => {
- const failAction = shouldSave ? 'fixed' : 'failed';
- console.log(
- `\nSummary:\n ${matchedCount} files processed (${passedCount} passed, ${failedCount} ${failAction}, ${ignoredCount} ignored)\n`,
- );
-
- if (didWarn) process.exit(1);
- })
- .catch((e) => {
- console.log(`\nAn error occurred while processing files with prettier: ${e.message}\n`);
- process.exit(1);
- });
diff --git a/scripts/frontend/stylelint/stylelint-duplicate-selectors.js b/scripts/frontend/stylelint/stylelint-duplicate-selectors.js
index 89242158157..982ddf524a3 100644
--- a/scripts/frontend/stylelint/stylelint-duplicate-selectors.js
+++ b/scripts/frontend/stylelint/stylelint-duplicate-selectors.js
@@ -1,5 +1,6 @@
const stylelint = require('stylelint');
const utils = require('./stylelint-utils');
+
const ruleName = 'stylelint-gitlab/duplicate-selectors';
const messages = stylelint.utils.ruleMessages(ruleName, {
@@ -8,12 +9,13 @@ const messages = stylelint.utils.ruleMessages(ruleName, {
},
});
-module.exports = stylelint.createPlugin(ruleName, function (enabled) {
+module.exports = stylelint.createPlugin(ruleName, (enabled) => {
if (!enabled) {
return;
}
- return function (root, result) {
+ // eslint-disable-next-line consistent-return
+ return (root, result) => {
const selectorGroups = {};
utils.createPropertiesHashmap(root, result, ruleName, messages, selectorGroups, true);
};
diff --git a/scripts/frontend/stylelint/stylelint-utility-classes.js b/scripts/frontend/stylelint/stylelint-utility-classes.js
index 1b266fc31c9..420fe82d826 100644
--- a/scripts/frontend/stylelint/stylelint-utility-classes.js
+++ b/scripts/frontend/stylelint/stylelint-utility-classes.js
@@ -10,12 +10,13 @@ const messages = stylelint.utils.ruleMessages(ruleName, {
},
});
-module.exports = stylelint.createPlugin(ruleName, function (enabled) {
+module.exports = stylelint.createPlugin(ruleName, (enabled) => {
if (!enabled) {
return;
}
- return function (root, result) {
+ // eslint-disable-next-line consistent-return
+ return (root, result) => {
utils.createPropertiesHashmap(root, result, ruleName, messages, utilityClasses, false);
};
});
diff --git a/scripts/frontend/stylelint/stylelint-utility-map.js b/scripts/frontend/stylelint/stylelint-utility-map.js
index bf8ee362740..545aade9ccc 100644
--- a/scripts/frontend/stylelint/stylelint-utility-map.js
+++ b/scripts/frontend/stylelint/stylelint-utility-map.js
@@ -1,10 +1,11 @@
-const sass = require('node-sass');
-const postcss = require('postcss');
const fs = require('fs');
+const sass = require('node-sass');
const path = require('path');
+const postcss = require('postcss');
const prettier = require('prettier');
const utils = require('./stylelint-utils');
+
const ROOT_PATH = path.resolve(__dirname, '../../..');
const hashMapPath = path.resolve(__dirname, './utility-classes-map.js');
@@ -22,19 +23,28 @@ sass.render(
includePaths: [path.resolve(ROOT_PATH, 'node_modules/bootstrap/scss')],
},
(err, result) => {
- if (err) console.error('Error ', err);
+ if (err) {
+ return console.error('Error ', err);
+ }
const cssResult = result.css.toString();
// We just use postcss to create a CSS tree
- postcss([])
+ return postcss([])
.process(cssResult, {
// This suppresses a postcss warning
from: undefined,
})
- .then((result) => {
+ .then((processedResult) => {
const selectorGroups = {};
- utils.createPropertiesHashmap(result.root, result, null, null, selectorGroups, true);
+ utils.createPropertiesHashmap(
+ processedResult.root,
+ processedResult,
+ null,
+ null,
+ selectorGroups,
+ true,
+ );
const prettierOptions = prettier.resolveConfig.sync(hashMapPath);
const prettyHashmap = prettier.format(
@@ -42,12 +52,12 @@ sass.render(
prettierOptions,
);
- fs.writeFile(hashMapPath, prettyHashmap, function (err) {
- if (err) {
- return console.log(err);
+ fs.writeFile(hashMapPath, prettyHashmap, (e) => {
+ if (e) {
+ return console.log(e);
}
- console.log('The file was saved!');
+ return console.log('The file was saved!');
});
});
},
diff --git a/scripts/frontend/stylelint/stylelint-utils.js b/scripts/frontend/stylelint/stylelint-utils.js
index e7452b0cdb2..c9d9c7d9aad 100644
--- a/scripts/frontend/stylelint/stylelint-utils.js
+++ b/scripts/frontend/stylelint/stylelint-utils.js
@@ -1,5 +1,5 @@
-const stylelint = require('stylelint');
const md5 = require('md5');
+const stylelint = require('stylelint');
module.exports.createPropertiesHashmap = (
ruleRoot,
@@ -15,7 +15,7 @@ module.exports.createPropertiesHashmap = (
if (
rule &&
rule.parent &&
- rule.parent.type != 'atrule' &&
+ rule.parent.type !== 'atrule' &&
!(
selector.includes('-webkit-') ||
selector.includes('-moz-') ||
@@ -25,7 +25,7 @@ module.exports.createPropertiesHashmap = (
)
) {
let cssArray = [];
- rule.nodes.forEach(function (property) {
+ rule.nodes.forEach((property) => {
const { prop, value } = property;
if (property && value) {
const propval = `${prop}${value}${property.important ? '!important' : ''}`;
@@ -41,11 +41,11 @@ module.exports.createPropertiesHashmap = (
const selObj = selectorGroups[hashValue];
const selectorLine = `${selector} (${
- rule.source.input.file ? rule.source.input.file + ' -' : ''
+ rule.source.input.file ? `${rule.source.input.file} -` : ''
}${rule.source.start.line}:${rule.source.start.column})`;
if (selObj) {
- if (selectorGroups[hashValue].selectors.indexOf(selector) == -1) {
+ if (selectorGroups[hashValue].selectors.indexOf(selector) === -1) {
let lastSelector =
selectorGroups[hashValue].selectors[selectorGroups[hashValue].selectors.length - 1];
@@ -67,6 +67,7 @@ module.exports.createPropertiesHashmap = (
}
}
} else if (addSelectors) {
+ // eslint-disable-next-line no-param-reassign
selectorGroups[hashValue] = {
selectors: [selectorLine],
};
diff --git a/scripts/frontend/webpack_dev_server.js b/scripts/frontend/webpack_dev_server.js
index fbb80c9617d..a76e6dc024a 100755
--- a/scripts/frontend/webpack_dev_server.js
+++ b/scripts/frontend/webpack_dev_server.js
@@ -2,8 +2,8 @@ const nodemon = require('nodemon');
const DEV_SERVER_HOST = process.env.DEV_SERVER_HOST || 'localhost';
const DEV_SERVER_PORT = process.env.DEV_SERVER_PORT || '3808';
-const STATIC_MODE = process.env.DEV_SERVER_STATIC && process.env.DEV_SERVER_STATIC != 'false';
-const DLL_MODE = process.env.WEBPACK_VENDOR_DLL && process.env.WEBPACK_VENDOR_DLL != 'false';
+const STATIC_MODE = process.env.DEV_SERVER_STATIC && process.env.DEV_SERVER_STATIC !== 'false';
+const DLL_MODE = process.env.WEBPACK_VENDOR_DLL && process.env.WEBPACK_VENDOR_DLL !== 'false';
const baseConfig = {
ignoreRoot: ['.git', 'node_modules/*/'],
@@ -30,7 +30,7 @@ if (STATIC_MODE) {
// run webpack through webpack-dev-server, optionally compiling a DLL to reduce memory
else {
- let watch = ['config/webpack.config.js'];
+ const watch = ['config/webpack.config.js'];
// if utilizing the vendor DLL, we need to restart the process when dependency changes occur
if (DLL_MODE) {
@@ -51,7 +51,7 @@ else {
// print useful messages for nodemon events
nodemon
- .on('start', function () {
+ .on('start', () => {
console.log(`Starting webpack webserver on http://${DEV_SERVER_HOST}:${DEV_SERVER_PORT}`);
if (STATIC_MODE) {
console.log('You are starting webpack in compile-once mode');
@@ -59,10 +59,10 @@ nodemon
console.log('If you change them often, you might want to unset DEV_SERVER_STATIC');
}
})
- .on('quit', function () {
+ .on('quit', () => {
console.log('Shutting down webpack process');
process.exit();
})
- .on('restart', function (files) {
+ .on('restart', (files) => {
console.log('Restarting webpack process due to: ', files);
});
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh
index 17c8cdaabec..4d0c1ba99d2 100755
--- a/scripts/lint-doc.sh
+++ b/scripts/lint-doc.sh
@@ -30,13 +30,13 @@ then
((ERRORCODE++))
fi
-# Test for non-standard spaces (NBSP, NNBSP) in documentation.
+# Test for non-standard spaces (NBSP, NNBSP, ZWSP) in documentation.
echo '=> Checking for non-standard spaces...'
echo
-grep --extended-regexp --binary-file=without-match --recursive '[  ]' doc/ >/dev/null 2>&1
+grep --extended-regexp --binary-file=without-match --recursive '[  ​]' doc/ >/dev/null 2>&1
if [ $? -eq 0 ]
then
- echo '✖ ERROR: Non-standard spaces (NBSP, NNBSP) should not be used in documentation.
+ echo '✖ ERROR: Non-standard spaces (NBSP, NNBSP, ZWSP) should not be used in documentation.
https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#spaces-between-words
Replace with standard spaces:' >&2
# Find the spaces, then add color codes with sed to highlight each NBSP or NNBSP in the output.
@@ -78,7 +78,7 @@ then
echo
echo ' ✖ ERROR: The number of README.md file(s) has changed. Use index.md instead of README.md.' >&2
echo ' ✖ If removing a README.md file, update NUMBER_READMES in lint-doc.sh.' >&2
- echo ' https://docs.gitlab.com/ee/development/documentation/styleguide.html#work-with-directories-and-files'
+ echo ' https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#work-with-directories-and-files'
echo
((ERRORCODE++))
fi
diff --git a/scripts/review_apps/base-config.yaml b/scripts/review_apps/base-config.yaml
index bfc35a6abde..cf55fca7452 100644
--- a/scripts/review_apps/base-config.yaml
+++ b/scripts/review_apps/base-config.yaml
@@ -16,11 +16,11 @@ gitlab:
gitaly:
resources:
requests:
- cpu: 1200m
- memory: 245M
+ cpu: 2400m
+ memory: 1000M
limits:
- cpu: 1800m
- memory: 367M
+ cpu: 3600m
+ memory: 1500M
persistence:
size: 10G
gitlab-exporter:
@@ -38,10 +38,10 @@ gitlab:
resources:
requests:
cpu: 500m
- memory: 25M
+ memory: 100M
limits:
cpu: 750m
- memory: 37.5M
+ memory: 150M
maxReplicas: 3
hpa:
targetAverageValue: 500m
@@ -52,10 +52,10 @@ gitlab:
resources:
requests:
cpu: 855m
- memory: 1285M
+ memory: 1927M
limits:
cpu: 1282m
- memory: 1927M
+ memory: 2890M
hpa:
targetAverageValue: 650m
task-runner:
@@ -138,10 +138,10 @@ postgresql:
resources:
requests:
cpu: 550m
- memory: 250M
+ memory: 1000M
limits:
cpu: 825m
- memory: 375M
+ memory: 1500M
prometheus:
install: false
redis:
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index 59e7d183ae7..88be78c7615 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -314,7 +314,7 @@ function deploy() {
if [[ "$(base_config_changed)" == "true" ]]; then base_config_file_ref="${CI_COMMIT_SHA}"; fi
local base_config_file="https://gitlab.com/gitlab-org/gitlab/raw/${base_config_file_ref}/scripts/review_apps/base-config.yaml"
- echoinfo "Deploying ${release}..." true
+ echoinfo "Deploying ${release} to ${CI_ENVIRONMENT_URL} ..." true
IMAGE_REPOSITORY="registry.gitlab.com/gitlab-org/build/cng-mirror"
gitlab_migrations_image_repository="${IMAGE_REPOSITORY}/gitlab-rails-ee"
diff --git a/scripts/static-analysis b/scripts/static-analysis
index febfdbd1da4..2442455e630 100755
--- a/scripts/static-analysis
+++ b/scripts/static-analysis
@@ -25,16 +25,15 @@ class StaticAnalysis
# Most of the time, RuboCop finishes in 30 seconds, but sometimes it can take around 1200 seconds so we set a
# duration of 300 to lower the likelihood that it will run in the same job as another long task...
%w[bundle exec rubocop --parallel] => 300,
- %w[yarn run eslint] => 197,
- %w[yarn run prettier-all] => 124,
+ %w[yarn run lint:eslint:all] => 197,
+ %w[yarn run lint:prettier] => 124,
%w[bin/rake gettext:lint] => 96,
%w[bundle exec license_finder] => 49,
- %w[bin/rake scss_lint] => 38,
%w[bin/rake lint:static_verification] => 22,
%w[bin/rake gitlab:sidekiq:all_queues_yml:check] => 13,
(Gitlab.ee? ? %w[bin/rake gitlab:sidekiq:sidekiq_queues_yml:check] : nil) => 13,
%w[bin/rake config_lint] => 11,
- %w[yarn run stylelint] => 9,
+ %w[yarn run lint:stylelint] => 9,
%w[scripts/lint-conflicts.sh] => 0.59,
%w[yarn run block-dependencies] => 0.35,
%w[scripts/lint-rugged] => 0.23,
diff --git a/scripts/update-workhorse b/scripts/update-workhorse
deleted file mode 100755
index 2c43b249fe4..00000000000
--- a/scripts/update-workhorse
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/sh
-set -e
-WORKHORSE_DIR=workhorse/
-WORKHORSE_REF="$(cat GITLAB_WORKHORSE_VERSION)"
-WORKHORSE_URL=${GITLAB_WORKHORSE_URL:-https://gitlab.com/gitlab-org/gitlab-workhorse.git}
-
-if [ $# -gt 1 ] || ([ $# = 1 ] && [ x$1 != xcheck ]); then
- echo "Usage: update-workhorse [check]"
- exit 1
-fi
-
-if echo "$WORKHORSE_REF" | grep -q '^[0-9]\+\.[0-9]\+\.[0-9]\+' ; then
- # Assume this is a tagged release
- WORKHORSE_REF="v${WORKHORSE_REF}"
-fi
-
-clean="$(git status --porcelain)"
-if [ -n "$clean" ] ; then
- echo 'error: working directory is not clean:'
- echo "$clean"
- exit 1
-fi
-
-git fetch "$WORKHORSE_URL" "$WORKHORSE_REF"
-git rm -rf --quiet -- "$WORKHORSE_DIR"
-git read-tree --prefix="$WORKHORSE_DIR" -u FETCH_HEAD
-
-status="$(git status --porcelain)"
-
-if [ x$1 = xcheck ]; then
- if [ -n "$status" ]; then
- cat <<MSG
-error: $WORKHORSE_DIR does not match $WORKHORSE_REF
-
-During the transition period of https://gitlab.com/groups/gitlab-org/-/epics/4826,
-the workhorse/ directory in this repository is read-only. To make changes:
-
-1. Submit a MR to https://gitlab.com/gitlab-org/gitlab-workhorse
-2. Once your MR is merged, have a new gitlab-workhorse tag made
- by a maintainer
-3. Update the GITLAB_WORKHORSE_VERSION file in this repository
-4. Run scripts/update-workhorse to update the workhorse/ directory
-
-MSG
- exit 1
- fi
- exit 0
-fi
-
-if [ -z "$status" ]; then
- echo "warn: $WORKHORSE_DIR is already up to date, exiting without commit"
- exit 0
-fi
-
-tree=$(git write-tree)
-msg="Update vendored workhorse to $WORKHORSE_REF"
-commit=$(git commit-tree -p HEAD -p FETCH_HEAD^{commit} -m "$msg" "$tree")
-git update-ref HEAD "$commit"
-git log -1
diff --git a/scripts/validate_migration_schema b/scripts/validate_migration_schema
index 95a9ae9f93f..0b909f7ac77 100755
--- a/scripts/validate_migration_schema
+++ b/scripts/validate_migration_schema
@@ -27,7 +27,7 @@ class MigrationSchemaValidator
private
def validate_schema_on_rollback!
- committed_migrations.each do |filename|
+ committed_migrations.reverse_each do |filename|
version = find_migration_version(filename)
run("bin/rails db:migrate:down VERSION=#{version}")
diff --git a/scripts/verify-tff-mapping b/scripts/verify-tff-mapping
index 9931e14008a..5bc4b23f99f 100755
--- a/scripts/verify-tff-mapping
+++ b/scripts/verify-tff-mapping
@@ -110,6 +110,12 @@ tests = [
explanation: 'Migration should map to its timestamped spec',
source: 'db/post_migrate/20190924152703_migrate_issue_trackers_data.rb',
expected: ['spec/migrations/20190924152703_migrate_issue_trackers_data_spec.rb']
+ },
+
+ {
+ explanation: 'Whats New should map to its respective spec',
+ source: 'data/whats_new/202101140001_13_08.yml',
+ expected: ['spec/lib/release_highlights/validator_spec.rb']
}
]