diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-02-20 18:06:26 +0100 |
---|---|---|
committer | Winnie Hellmann <winnie@gitlab.com> | 2019-02-20 19:37:56 +0100 |
commit | c01791446eb47e0acc9cbb9f286651661409ee46 (patch) | |
tree | af5ac7f27a555cc03370907884cba327e3056ebf | |
parent | 08e2104e0445877a056468d4675aa72af5ebb2ae (diff) | |
download | gitlab-ce-winh-only-frontend-tests-frontend.tar.gz |
Run only feature specs for frontend brancheswinh-only-frontend-tests-frontend
-rw-r--r-- | .gitlab-ci.yml | 1 | ||||
-rwxr-xr-x | scripts/knapsack_file_pattern.rb | 17 |
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 |