summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml1
-rwxr-xr-xscripts/knapsack_file_pattern.rb17
2 files changed, 18 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c5cd006a289..9a24011bbae 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -140,6 +140,7 @@ stages:
script:
- JOB_NAME=( $CI_JOB_NAME )
- TEST_TOOL=${JOB_NAME[0]}
+ - export KNAPSACK_TEST_FILE_PATTERN=$(scripts/knapsack_file_pattern.rb)
- export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${TEST_TOOL}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
- export KNAPSACK_GENERATE_REPORT=true
- export SUITE_FLAKY_RSPEC_REPORT_PATH=${FLAKY_RSPEC_SUITE_REPORT_PATH}
diff --git a/scripts/knapsack_file_pattern.rb b/scripts/knapsack_file_pattern.rb
new file mode 100755
index 00000000000..69c5f22e006
--- /dev/null
+++ b/scripts/knapsack_file_pattern.rb
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+
+# Change test file pattern to match only feature specs for branches ending with "-frontend"
+class KnapsackFilePattern
+ def run
+ frontend_branch = ENV['CI_COMMIT_REF_NAME'] =~ /-frontend(-ee)?$/
+
+ if ENV['CI_PROJECT_NAMESPACE'] == 'gitlab-org' && frontend_branch
+ warn 'Running only feature specs for frontend branch...'
+ puts 'spec/features/**{,/*/**}/*_spec.rb'
+ else
+ puts 'spec/**{,/*/**}/*_spec.rb'
+ end
+ end
+end
+
+KnapsackFilePattern.new.run