summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-16 18:08:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-16 18:08:22 +0000
commit123c68a7cf788ace140e57e478a12c5b7ac893ae (patch)
treeb36e565ecd895ee46c1713f3734308cfce0e6ba9 /scripts
parent862d225ca0d8eb452e56b8fe5a0109aac796e872 (diff)
downloadgitlab-ce-123c68a7cf788ace140e57e478a12c5b7ac893ae.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/frontend/check_no_partial_karma_jest.sh38
-rwxr-xr-xscripts/static-analysis3
-rw-r--r--scripts/sync-stable-branch.sh14
3 files changed, 54 insertions, 1 deletions
diff --git a/scripts/frontend/check_no_partial_karma_jest.sh b/scripts/frontend/check_no_partial_karma_jest.sh
new file mode 100755
index 00000000000..0d0c897bb18
--- /dev/null
+++ b/scripts/frontend/check_no_partial_karma_jest.sh
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+karma_files=$(find spec/javascripts ee/spec/javascripts -type f -name '*_spec.js' -not -path '*/helpers/*')
+violations=""
+
+for karma_file in $karma_files; do
+ jest_file=${karma_file/spec\/javascripts/"spec/frontend"}
+
+ if [ -f $jest_file ]; then
+ violations="$violations $jest_file"
+ fi
+done
+
+if [[ -z "$violations" ]]; then
+ echo "All good!"
+ exit 0
+else
+ echo "Danger! The following Jest specs have corresponding files in the Karma spec directory (i.e. spec/javascripts):"
+ echo ""
+ echo "------------------------------"
+ for file in $violations; do
+ echo $file
+ done
+ echo "------------------------------"
+ echo ""
+ echo "For each of these files, please either:"
+ echo ""
+ echo "1. Fully migrate the file to Jest and remove the corresponding Karma file."
+ echo "2. Remove the Jest file for now, make any relevant changes in the corresponding Karma file, and handle the migration to Jest in a separate MR."
+ echo ""
+ echo "Why is this a problem?"
+ echo ""
+ echo "- It's nice to have a single source of truth for the unit tests of a subject."
+ echo "- This will cause conflicts if the remaining Karma spec is migrated using our automated tool."
+ echo " https://gitlab.com/gitlab-org/frontend/playground/migrate-karma-to-jest"
+ echo ""
+ exit 1
+fi
diff --git a/scripts/static-analysis b/scripts/static-analysis
index b7f7100c365..1392a4f6a23 100755
--- a/scripts/static-analysis
+++ b/scripts/static-analysis
@@ -35,7 +35,8 @@ def jobs_to_run(node_index, node_total)
%w[yarn run prettier-all],
%w[bundle exec rubocop --parallel],
%w[scripts/lint-conflicts.sh],
- %w[scripts/lint-rugged]
+ %w[scripts/lint-rugged],
+ %w[scripts/frontend/check_no_partial_karma_jest.sh]
]
case node_total
diff --git a/scripts/sync-stable-branch.sh b/scripts/sync-stable-branch.sh
index fc62453d743..b44bf26a151 100644
--- a/scripts/sync-stable-branch.sh
+++ b/scripts/sync-stable-branch.sh
@@ -23,10 +23,24 @@ then
exit 1
fi
+if [[ "$SOURCE_PROJECT" == '' ]]
+then
+ echo 'The variable SOURCE_PROJECT must be set to a non-empy value'
+ exit 1
+fi
+
+if [[ "$TARGET_PROJECT" == '' ]]
+then
+ echo 'The variable TARGET_PROJECT must be set to a non-empy value'
+ exit 1
+fi
+
curl -X POST \
-F token="$MERGE_TRAIN_TRIGGER_TOKEN" \
-F ref=master \
-F "variables[MERGE_FOSS]=1" \
-F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \
-F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \
+ -F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \
+ -F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \
"$MERGE_TRAIN_TRIGGER_URL"