Commit ca4f0850 authored by Sanad Liaquat's avatar Sanad Liaquat Committed by Ash McKenzie

If an MR changes only e2e tests, run only those e2e tests

parent 5f03cce6
...@@ -58,6 +58,9 @@ update-qa-cache: ...@@ -58,6 +58,9 @@ update-qa-cache:
- tooling/bin/find_change_diffs ${CHANGES_DIFFS_DIR} - tooling/bin/find_change_diffs ${CHANGES_DIFFS_DIR}
script: script:
- | - |
tooling/bin/qa/check_if_qa_only_spec_changes ${CHANGES_FILE} ${ONLY_QA_CHANGES_FILE}
[ -f $ONLY_QA_CHANGES_FILE ] && export QA_TESTS="`cat $ONLY_QA_CHANGES_FILE`"
echo "QA_TESTS: $QA_TESTS"
tooling/bin/qa/package_and_qa_check ${CHANGES_DIFFS_DIR} && exit_code=$? tooling/bin/qa/package_and_qa_check ${CHANGES_DIFFS_DIR} && exit_code=$?
if [ $exit_code -eq 0 ]; then if [ $exit_code -eq 0 ]; then
./scripts/trigger-build omnibus ./scripts/trigger-build omnibus
...@@ -80,9 +83,11 @@ update-qa-cache: ...@@ -80,9 +83,11 @@ update-qa-cache:
expire_in: 7d expire_in: 7d
paths: paths:
- ${CHANGES_FILE} - ${CHANGES_FILE}
- ${ONLY_QA_CHANGES_FILE}
- ${CHANGES_DIFFS_DIR}/* - ${CHANGES_DIFFS_DIR}/*
variables: variables:
CHANGES_FILE: tmp/changed_files.txt CHANGES_FILE: tmp/changed_files.txt
ONLY_QA_CHANGES_FILE: tmp/qa_only_changed_files.txt
CHANGES_DIFFS_DIR: tmp/diffs CHANGES_DIFFS_DIR: tmp/diffs
.package-and-qa-ff-base: .package-and-qa-ff-base:
......
...@@ -155,7 +155,8 @@ module Trigger ...@@ -155,7 +155,8 @@ module Trigger
'ee' => Trigger.ee? ? 'true' : 'false', 'ee' => Trigger.ee? ? 'true' : 'false',
'QA_BRANCH' => ENV['QA_BRANCH'] || 'master', 'QA_BRANCH' => ENV['QA_BRANCH'] || 'master',
'CACHE_UPDATE' => ENV['OMNIBUS_GITLAB_CACHE_UPDATE'], 'CACHE_UPDATE' => ENV['OMNIBUS_GITLAB_CACHE_UPDATE'],
'GITLAB_QA_OPTIONS' => ENV['GITLAB_QA_OPTIONS'] 'GITLAB_QA_OPTIONS' => ENV['GITLAB_QA_OPTIONS'],
'QA_TESTS' => ENV['QA_TESTS']
} }
end end
end end
......
#!/usr/bin/env ruby
# frozen_string_literal: true
# This script assumes the first argument is a path to a file containing a list of changed files and the second argument
# is the path of a file where a list of end-to-end spec files with the leading 'qa/' trimmed will be written to if
# all the files are end-to-end test spec files.
abort("ERROR: Please specify the file containing the list of changed files and a file where the qa only spec files will be written") if ARGV.size != 2
file_contents = File.read(ARGV.shift).split(' ')
all_files_are_qa_specs = file_contents.all? { |file_path| file_path =~ %r{^qa\/qa\/specs\/features\/} }
output_file = ARGV.shift
if all_files_are_qa_specs
qa_spec_paths_trimmed = file_contents.map { |path| path.sub('qa/', '') }
File.write(output_file, qa_spec_paths_trimmed.join(' '))
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment