diff options
author | Mikhail Shchatko <mikhail.shchatko@mongodb.com> | 2022-02-15 08:24:01 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-15 08:51:14 +0000 |
commit | 7bd6a08e6ed1f308cba776cb1c71d9ccb3c0dfbe (patch) | |
tree | 0adcce63d973897c807ac38deb71b5f2efc6a9ef | |
parent | d02536f48aee7593077c12b1e60829b9441a7c08 (diff) | |
download | mongo-7bd6a08e6ed1f308cba776cb1c71d9ccb3c0dfbe.tar.gz |
SERVER-61686 Fix multiversion tags in burn_in_tests
-rw-r--r-- | buildscripts/evergreen_burn_in_tests.py | 38 | ||||
-rw-r--r-- | buildscripts/patch_builds/task_generation.py | 4 | ||||
-rw-r--r-- | buildscripts/task_generation/constants.py | 4 | ||||
-rw-r--r-- | etc/evergreen.yml | 10 | ||||
-rwxr-xr-x | evergreen/burn_in_tests.sh | 7 | ||||
-rw-r--r-- | evergreen/burn_in_tests_generate.sh | 7 | ||||
-rw-r--r-- | evergreen/implicit_multiversions_tasks_generate.sh | 13 | ||||
-rw-r--r-- | evergreen/multiversion_exclude_tags_generate.sh | 19 |
8 files changed, 53 insertions, 49 deletions
diff --git a/buildscripts/evergreen_burn_in_tests.py b/buildscripts/evergreen_burn_in_tests.py index 9e0f530aea4..7ac28e4063c 100644 --- a/buildscripts/evergreen_burn_in_tests.py +++ b/buildscripts/evergreen_burn_in_tests.py @@ -22,7 +22,7 @@ from buildscripts.patch_builds.evg_change_data import generate_revision_map_from from buildscripts.patch_builds.task_generation import TimeoutInfo, resmoke_commands, \ validate_task_generation_limit from buildscripts.task_generation.constants import CONFIG_FILE, EVERGREEN_FILE, ARCHIVE_DIST_TEST_DEBUG_TASK, \ - EXCLUDES_TAGS_FILE_PATH, BACKPORT_REQUIRED_TAG + BACKPORT_REQUIRED_TAG, RUN_TESTS, EXCLUDES_TAGS_FILE from buildscripts.task_generation.suite_split import SubSuite, GeneratedSuite from buildscripts.task_generation.task_types.resmoke_tasks import EXCLUDE_TAGS from buildscripts.util.fileops import write_file @@ -215,26 +215,28 @@ class BurnInGenTaskService: return TimeoutInfo.default_timeout() - def _generate_resmoke_args(self, task_name: str, suite_name: str, params: BurnInGenTaskParams, - test_arg: str) -> str: + def _generate_run_tests_vars(self, task_name: str, suite_name: str, params: BurnInGenTaskParams, + test_arg: str) -> Dict[str, str]: + run_test_vars = {"suite": suite_name} + resmoke_args = f"{params.resmoke_args} {self.repeat_config.generate_resmoke_options()} {test_arg}" if params.require_multiversion_setup: + run_test_vars["require_multiversion_setup"] = params.require_multiversion_setup + # TODO: inspect the suite for version instead of doing string parsing on the name. - tag_file_base_path = EXCLUDES_TAGS_FILE_PATH[:-4] if "last_continuous" in suite_name: - tag_file = f"{tag_file_base_path}_last_continuous.yml" + run_test_vars["multiversion_exclude_tags_version"] = "last_continuous" + resmoke_args += f" --tagFile={EXCLUDES_TAGS_FILE}" elif "last_lts" in suite_name: - tag_file = f"{tag_file_base_path}_last_lts.yml" - else: - tag_file = None - - if tag_file is not None: - resmoke_args += f" --tagFile={tag_file}" + run_test_vars["multiversion_exclude_tags_version"] = "last_lts" + resmoke_args += f" --tagFile={EXCLUDES_TAGS_FILE}" resmoke_args += f" --excludeWithAnyTags={EXCLUDE_TAGS},{task_name}_{BACKPORT_REQUIRED_TAG} " - return resmoke_args + run_test_vars["resmoke_args"] = resmoke_args + + return run_test_vars def _generate_task_name(self, gen_suite: GeneratedSuite, index: int) -> str: """ @@ -250,7 +252,7 @@ class BurnInGenTaskService: return name_generated_task(f"{prefix}:{task_name}", index, len(gen_suite), self.generate_config.run_build_variant) - def generate_tasks(self, gen_suite: GeneratedSuite, params: BurnInGenTaskParams) -> List[Task]: + def generate_tasks(self, gen_suite: GeneratedSuite, params: BurnInGenTaskParams) -> Set[Task]: """Create the task configuration for the given test using the given index.""" tasks = set() @@ -260,15 +262,11 @@ class BurnInGenTaskService: f"Can only run one test per suite in burn-in; got {suite.test_list}") test_name = suite.test_list[0] test_unix_style = test_name.replace('\\', '/') - run_tests_vars = { - "suite": - gen_suite.suite_name, "resmoke_args": - self._generate_resmoke_args(gen_suite.task_name, gen_suite.suite_name, - params, test_unix_style) - } + run_tests_vars = self._generate_run_tests_vars( + gen_suite.task_name, gen_suite.suite_name, params, test_unix_style) timeout_cmd = self.generate_timeouts(test_name) - commands = resmoke_commands("run tests", run_tests_vars, timeout_cmd, + commands = resmoke_commands(RUN_TESTS, run_tests_vars, timeout_cmd, params.require_multiversion_setup) dependencies = {TaskDependency(ARCHIVE_DIST_TEST_DEBUG_TASK)} diff --git a/buildscripts/patch_builds/task_generation.py b/buildscripts/patch_builds/task_generation.py index d8d9ff267d4..7eb0e3f5bf2 100644 --- a/buildscripts/patch_builds/task_generation.py +++ b/buildscripts/patch_builds/task_generation.py @@ -7,7 +7,7 @@ from shrub.v2 import FunctionCall, ShrubProject from shrub.v2.command import timeout_update, ShrubCommand from structlog import get_logger -from buildscripts.task_generation.constants import CONFIGURE_EVG_CREDENTIALS +from buildscripts.task_generation.constants import CONFIGURE_EVG_CREDENTIALS, DO_MULTIVERSION_SETUP LOGGER = get_logger(__name__) MAX_SHRUB_TASKS_FOR_SINGLE_TASK = 1000 @@ -47,7 +47,7 @@ def resmoke_commands(run_tests_fn_name: str, run_tests_vars: Dict[str, Any], FunctionCall("add git tag") if require_multiversion_setup else None, FunctionCall("do setup"), FunctionCall(CONFIGURE_EVG_CREDENTIALS), - FunctionCall("do multiversion setup") if require_multiversion_setup else None, + FunctionCall(DO_MULTIVERSION_SETUP) if require_multiversion_setup else None, FunctionCall(run_tests_fn_name, run_tests_vars), ] diff --git a/buildscripts/task_generation/constants.py b/buildscripts/task_generation/constants.py index 31531d3592d..528d2a3e51b 100644 --- a/buildscripts/task_generation/constants.py +++ b/buildscripts/task_generation/constants.py @@ -13,7 +13,8 @@ MAX_WORKERS = 16 LOOKBACK_DURATION_DAYS = 14 MAX_TASK_PRIORITY = 99 GENERATED_CONFIG_DIR = "generated_resmoke_config" -EXCLUDES_TAGS_FILE_PATH = os.path.join(GENERATED_CONFIG_DIR, "multiversion_exclude_tags.yml") +EXCLUDES_TAGS_FILE = "multiversion_exclude_tags.yml" +EXCLUDES_TAGS_FILE_PATH = os.path.join(GENERATED_CONFIG_DIR, EXCLUDES_TAGS_FILE) GEN_PARENT_TASK = "generator_tasks" EXPANSION_RE = re.compile(r"\${(?P<id>[a-zA-Z0-9_]+)(\|(?P<default>.*))?}") BACKPORT_REQUIRED_TAG = "backport_required_multiversion" @@ -22,3 +23,4 @@ BACKPORT_REQUIRED_TAG = "backport_required_multiversion" CONFIGURE_EVG_CREDENTIALS = "configure evergreen api credentials" DO_MULTIVERSION_SETUP = "do multiversion setup" RUN_GENERATED_TESTS = "run generated tests" +RUN_TESTS = "run tests" diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 5a974bb60a4..df56555697b 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -1209,7 +1209,7 @@ functions: params: binary: bash args: - - "./src/evergreen/implicit_multiversions_tasks_generate.sh" + - "./src/evergreen/multiversion_exclude_tags_generate.sh" - *execute_resmoke_tests - *minimize_jstestfuzz # The existence of the "run_tests_infrastructure_failure" file indicates this failure isn't @@ -1253,6 +1253,12 @@ functions: - *determine_resmoke_jobs - *update_resmoke_jobs_expansions - *f_expansions_write + - *configure_evergreen_api_credentials + - command: subprocess.exec + params: + binary: bash + args: + - "./src/evergreen/multiversion_exclude_tags_generate.sh" - *execute_resmoke_tests # The existence of the "run_tests_infrastructure_failure" file indicates this failure isn't # directly actionable. We use type=setup rather than type=system or type=test for this command @@ -3123,7 +3129,6 @@ tasks: - func: "set up venv" - func: "upload pip requirements" - func: "configure evergreen api credentials" - - *do_multiversion_setup - command: subprocess.exec type: test params: @@ -4188,7 +4193,6 @@ tasks: - func: "set up venv" - func: "upload pip requirements" - func: "configure evergreen api credentials" - - func: "do multiversion setup" - func: "generate burn in tags" vars: max_revisions: 25 diff --git a/evergreen/burn_in_tests.sh b/evergreen/burn_in_tests.sh index 69beb2a7713..23ac58851d4 100755 --- a/evergreen/burn_in_tests.sh +++ b/evergreen/burn_in_tests.sh @@ -5,14 +5,11 @@ cd src set -o errexit set -o verbose -activate_venv -# Multiversion exclusions can be used when selecting tests. -PATH="$PATH:/data/multiversion" -$python buildscripts/resmoke.py generate-multiversion-exclude-tags --oldBinVersion=last_continuous --excludeTagsFilePath=multiversion_exclude_tags.yml +activate_venv # Capture a list of new and modified tests. The expansion macro burn_in_tests_build_variant -# is used to for finding the associated tasks from a different build varaint than the +# is used to for finding the associated tasks from a different build variant than the # burn_in_tests_gen task executes on. build_variant_opts="--build-variant=${build_variant}" if [ -n "${burn_in_tests_build_variant}" ]; then diff --git a/evergreen/burn_in_tests_generate.sh b/evergreen/burn_in_tests_generate.sh index acd394b91a2..639a18e0045 100644 --- a/evergreen/burn_in_tests_generate.sh +++ b/evergreen/burn_in_tests_generate.sh @@ -4,12 +4,9 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" cd src set -o errexit +set -o verbose activate_venv -# Multiversion exclusions can be used when selecting tests. -PATH="$PATH:/data/multiversion" -$python buildscripts/resmoke.py generate-multiversion-exclude-tags --oldBinVersion=last_continuous --excludeTagsFilePath=multiversion_exclude_tags_last_continuous.yml -$python buildscripts/resmoke.py generate-multiversion-exclude-tags --oldBinVersion=last_lts --excludeTagsFilePath=multiversion_exclude_tags_last_lts.yml - +# Evergreen executable is in $HOME. PATH=$PATH:$HOME $python buildscripts/burn_in_tags.py --expansion-file ../expansions.yml diff --git a/evergreen/implicit_multiversions_tasks_generate.sh b/evergreen/implicit_multiversions_tasks_generate.sh deleted file mode 100644 index 78eb852eccd..00000000000 --- a/evergreen/implicit_multiversions_tasks_generate.sh +++ /dev/null @@ -1,13 +0,0 @@ -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" -. "$DIR/prelude.sh" - -cd src - -set -o errexit - -activate_venv -PATH="$PATH:/data/multiversion" - -if [[ "${require_multiversion_setup}" = "true" && -n "${multiversion_exclude_tags_version}" ]]; then - $python buildscripts/resmoke.py generate-multiversion-exclude-tags --oldBinVersion="${multiversion_exclude_tags_version}" -fi diff --git a/evergreen/multiversion_exclude_tags_generate.sh b/evergreen/multiversion_exclude_tags_generate.sh new file mode 100644 index 00000000000..71ed97f3ce5 --- /dev/null +++ b/evergreen/multiversion_exclude_tags_generate.sh @@ -0,0 +1,19 @@ +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" +. "$DIR/prelude.sh" + +cd src + +set -o errexit +set -o verbose + +activate_venv +PATH="$PATH:/data/multiversion" + +if [[ "${require_multiversion_setup}" = "true" && -n "${multiversion_exclude_tags_version}" ]]; then + exclude_tags_file_path_arg="" + if [ ! -d generated_resmoke_config ]; then + exclude_tags_file_path_arg="--excludeTagsFilePath=multiversion_exclude_tags.yml" + fi + + eval $python buildscripts/resmoke.py generate-multiversion-exclude-tags --oldBinVersion="${multiversion_exclude_tags_version}" "$exclude_tags_file_path_arg" +fi |