summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 08:17:02 +0000
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /scripts
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
downloadgitlab-ce-b39512ed755239198a9c294b6a45e65c05900235.tar.gz
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/glfm/render_wysiwyg_html_and_json.js3
-rw-r--r--scripts/lib/glfm/update_example_snapshots.rb10
-rwxr-xr-xscripts/lint-vendored-gems.sh5
-rwxr-xr-xscripts/perf/query_limiting_report.rb2
-rwxr-xr-xscripts/qa/testcases-check4
-rwxr-xr-xscripts/review_apps/review-apps.sh4
-rwxr-xr-xscripts/static-analysis7
-rwxr-xr-xscripts/trigger-build.rb5
-rwxr-xr-xscripts/undercoverage3
-rw-r--r--scripts/utils.sh6
-rwxr-xr-xscripts/validate_migration_schema2
11 files changed, 33 insertions, 18 deletions
diff --git a/scripts/lib/glfm/render_wysiwyg_html_and_json.js b/scripts/lib/glfm/render_wysiwyg_html_and_json.js
index ed8bfdb4638..8f94f50d62b 100644
--- a/scripts/lib/glfm/render_wysiwyg_html_and_json.js
+++ b/scripts/lib/glfm/render_wysiwyg_html_and_json.js
@@ -1,6 +1,5 @@
import fs from 'fs';
import jsYaml from 'js-yaml';
-import { setTestTimeout } from 'jest/__helpers__/timeout';
import { renderHtmlAndJsonForAllExamples } from 'jest/content_editor/render_html_and_json_for_all_examples';
/* eslint-disable no-undef */
@@ -24,7 +23,7 @@ jest.mock('~/emoji');
// This script should be invoked via jest with the a command similar to the following:
// yarn jest --testMatch '**/render_wysiwyg_html_and_json.js' ./scripts/lib/glfm/render_wysiwyg_html_and_json.js
it('serializes html to prosemirror json', async () => {
- setTestTimeout(20000);
+ jest.setTimeout(20000);
const inputMarkdownTempfilePath = process.env.INPUT_MARKDOWN_YML_PATH;
expect(inputMarkdownTempfilePath).not.toBeUndefined();
diff --git a/scripts/lib/glfm/update_example_snapshots.rb b/scripts/lib/glfm/update_example_snapshots.rb
index 893d8d9c014..d8d6cf3cdbc 100644
--- a/scripts/lib/glfm/update_example_snapshots.rb
+++ b/scripts/lib/glfm/update_example_snapshots.rb
@@ -29,6 +29,8 @@ module Glfm
def process(skip_static_and_wysiwyg: false)
output('Updating example snapshots...')
+ setup_environment
+
output('(Skipping static HTML generation)') if skip_static_and_wysiwyg
output("Reading #{GLFM_SPEC_TXT_PATH}...")
@@ -47,6 +49,14 @@ module Glfm
private
+ def setup_environment
+ # Set 'GITLAB_TEST_FOOTNOTE_ID' in order to override random number generation in
+ # Banzai::Filter::FootnoteFilter#random_number, and thus avoid the need to
+ # perform normalization on the value. See:
+ # https://docs.gitlab.com/ee/development/gitlab_flavored_markdown/specification_guide/#normalization
+ ENV['GITLAB_TEST_FOOTNOTE_ID'] = '42'
+ end
+
def add_example_names(all_examples)
# NOTE: This method and the parse_examples method assume:
# 1. Section 2 is the first section which contains examples
diff --git a/scripts/lint-vendored-gems.sh b/scripts/lint-vendored-gems.sh
new file mode 100755
index 00000000000..ac8b837bbd1
--- /dev/null
+++ b/scripts/lint-vendored-gems.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+# Rubocop doesn't have a good way to run excluded files without a separate invocation:
+# https://github.com/rubocop/rubocop/issues/6323
+find vendor/gems -name \*.gemspec | xargs bundle exec rubocop --only Gemspec/AvoidExecutingGit
diff --git a/scripts/perf/query_limiting_report.rb b/scripts/perf/query_limiting_report.rb
index 2f263eeb567..89abc1b301b 100755
--- a/scripts/perf/query_limiting_report.rb
+++ b/scripts/perf/query_limiting_report.rb
@@ -124,7 +124,7 @@ class QueryLimitingReport
file_lines.each_index do |index|
line = file_lines[index]
- if line =~ /#{CODE_LINES_SEARCH_STRING}/
+ if line =~ /#{CODE_LINES_SEARCH_STRING}/o
issue_iid = line.slice(%r{issues/(\d+)\D}, 1)
line_number = index + 1
code_line = {
diff --git a/scripts/qa/testcases-check b/scripts/qa/testcases-check
index 1d7a9d04e7b..12af15fe73f 100755
--- a/scripts/qa/testcases-check
+++ b/scripts/qa/testcases-check
@@ -51,9 +51,9 @@ tests.each do |test|
end
end
-testcase_list = testcases.group_by {|testcase| testcase.shift}.transform_values(&:flatten)
+testcase_list = testcases.group_by { |testcase| testcase.shift }.transform_values(&:flatten)
-duplicates = testcase_list.select {|k, v| v.count > 1}
+duplicates = testcase_list.select { |k, v| v.count > 1 }
unless duplicates.empty?
duplicates.each do |duplicate|
diff --git a/scripts/review_apps/review-apps.sh b/scripts/review_apps/review-apps.sh
index b6ac7b4281b..e979d0f75cf 100755
--- a/scripts/review_apps/review-apps.sh
+++ b/scripts/review_apps/review-apps.sh
@@ -219,7 +219,7 @@ function create_application_secret() {
kubectl create secret generic --namespace "${namespace}" \
"shared-gitlab-initial-root-password" \
--from-literal="password=${REVIEW_APPS_ROOT_PASSWORD}" \
- --dry-run -o json | kubectl apply -f -
+ --dry-run=client -o json | kubectl apply -f -
else
echoinfo "The 'shared-gitlab-initial-root-password' secret already exists in the ${namespace} namespace."
fi
@@ -232,7 +232,7 @@ function create_application_secret() {
kubectl create secret generic --namespace "${namespace}" \
"shared-gitlab-license" \
--from-file=license="${REVIEW_APPS_EE_LICENSE_FILE}" \
- --dry-run -o json | kubectl apply -f -
+ --dry-run=client -o json | kubectl apply -f -
else
echoinfo "The 'shared-gitlab-license' secret already exists in the ${namespace} namespace."
fi
diff --git a/scripts/static-analysis b/scripts/static-analysis
index 14d6a3deccb..1e9fe1cc724 100755
--- a/scripts/static-analysis
+++ b/scripts/static-analysis
@@ -11,7 +11,9 @@ class StaticAnalysis
# https://github.com/browserslist/browserslist/blob/d0ec62eb48c41c218478cd3ac28684df051cc865/node.js#L329
# warns if caniuse-lite package is older than 6 months. Ignore this
# warning message so that GitLab backports don't fail.
- "Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`"
+ "Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`",
+ # https://github.com/mime-types/mime-types-data/pull/50#issuecomment-1060908930
+ "Type application/netcdf is already registered as a variant of application/netcdf."
].freeze
Task = Struct.new(:command, :duration) do
@@ -57,7 +59,8 @@ class StaticAnalysis
Task.new(%w[yarn run block-dependencies], 1),
Task.new(%w[yarn run check-dependencies], 1),
Task.new(%w[scripts/lint-rugged], 1),
- Task.new(%w[scripts/gemfile_lock_changed.sh], 1)
+ Task.new(%w[scripts/gemfile_lock_changed.sh], 1),
+ Task.new(%w[scripts/lint-vendored-gems.sh], 1)
].compact.freeze
def run_tasks!(options = {})
diff --git a/scripts/trigger-build.rb b/scripts/trigger-build.rb
index 28b52fa916a..57cc6a8551e 100755
--- a/scripts/trigger-build.rb
+++ b/scripts/trigger-build.rb
@@ -382,9 +382,10 @@ module Trigger
private
def ops_gitlab_client
+ # No access token is needed here - we only use this client to trigger pipelines,
+ # and the trigger token authenticates the request to the pipeline
@ops_gitlab_client ||= Gitlab.client(
- endpoint: 'https://ops.gitlab.net/api/v4',
- private_token: ENV['GITLABCOM_DATABASE_TESTING_ACCESS_TOKEN']
+ endpoint: 'https://ops.gitlab.net/api/v4'
)
end
diff --git a/scripts/undercoverage b/scripts/undercoverage
index b9266b015a7..86153671d6a 100755
--- a/scripts/undercoverage
+++ b/scripts/undercoverage
@@ -22,4 +22,5 @@ end
compare_base = ARGV[0]
compare_base ||= IO.popen(%w(git merge-base origin/master HEAD)) { |p| p.read.chomp }
-Undercover::CLI.run(%W(-c #{compare_base}))
+result = Undercover::CLI.run(%W(-c #{compare_base}))
+exit result
diff --git a/scripts/utils.sh b/scripts/utils.sh
index d9205921963..8db525abc93 100644
--- a/scripts/utils.sh
+++ b/scripts/utils.sh
@@ -72,10 +72,6 @@ function setup_db() {
run_timed_command "setup_db_praefect"
}
-function install_api_client_dependencies_with_apk() {
- run_timed_command "apk add --update openssl curl jq"
-}
-
function install_gitlab_gem() {
run_timed_command "gem install httparty --no-document --version 0.18.1"
run_timed_command "gem install gitlab --no-document --version 4.17.0"
@@ -185,5 +181,5 @@ function danger_as_local() {
# Force danger to skip CI source GitLab and fallback to "local only git repo".
unset GITLAB_CI
# We need to base SHA to help danger determine the base commit for this shallow clone.
- bundle exec danger dry_run --fail-on-errors=true --verbose --base="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" --head="${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}"
+ bundle exec danger dry_run --fail-on-errors=true --verbose --base="${CI_MERGE_REQUEST_DIFF_BASE_SHA}" --head="${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}" --dangerfile="${DANGER_DANGERFILE:-Dangerfile}"
}
diff --git a/scripts/validate_migration_schema b/scripts/validate_migration_schema
index dded5c64927..5c389851844 100755
--- a/scripts/validate_migration_schema
+++ b/scripts/validate_migration_schema
@@ -87,7 +87,7 @@ class MigrationSchemaValidator
def find_migration_version(filename)
file_basename = File.basename(filename)
- version_match = /\A(?<version>\d{#{VERSION_DIGITS}})_/.match(file_basename)
+ version_match = /\A(?<version>\d{#{VERSION_DIGITS}})_/o.match(file_basename)
die "#{filename} has an invalid migration version" if version_match.nil?