Exemple #1
0
def _generate_shrub_config(evg_api: EvergreenApi,
                           evg_conf: EvergreenProjectConfig,
                           expansion_file: str, tests_by_task: dict,
                           build_variant: str):
    """
    Generate a dict containing file names and contents for the generated configs.

    :param evg_api: Evergreen API object.
    :param evg_conf: Evergreen configuration.
    :param expansion_file: Configuration file.
    :param tests_by_task: Dictionary of tests and tasks to run.
    :param build_variant: Build variant to collect task info from.
    return: Dict of files and file contents for generated tasks.
    """
    shrub_config = Configuration()
    shrub_task_config = None
    config_dict_of_generated_tasks = {}
    for task_name, test_list_info in tests_by_task.items():
        evg_task_config = _get_evg_task_configuration(evg_conf, build_variant,
                                                      task_name,
                                                      test_list_info)
        selected_tests_task_config = _get_selected_tests_task_configuration(
            expansion_file)
        evg_task_config.update(selected_tests_task_config)
        LOGGER.debug("Calculated overwrite_values",
                     overwrite_values=evg_task_config)
        config_options = SelectedTestsConfigOptions.from_file(
            expansion_file,
            evg_task_config,
            REQUIRED_CONFIG_KEYS,
            DEFAULT_CONFIG_VALUES,
            CONFIG_FORMAT_FN,
        )
        suite_files_dict, shrub_task_config = GenerateSubSuites(
            evg_api,
            config_options).generate_task_config_and_suites(shrub_config)
        config_dict_of_generated_tasks.update(suite_files_dict)
    if shrub_task_config:
        config_dict_of_generated_tasks[
            "selected_tests_config.json"] = shrub_task_config
    return config_dict_of_generated_tasks
def _update_config_with_task(evg_api: EvergreenApi, shrub_config: Configuration,
                             config_options: SelectedTestsConfigOptions,
                             config_dict_of_suites_and_tasks: Dict[str, str]):
    """
    Generate the suites config and the task shrub config for a given task config.

    :param evg_api: Evergreen API object.
    :param shrub_config: Shrub configuration for task.
    :param config_options: Task configuration options.
    :param config_dict_of_suites_and_tasks: Dict of shrub configs and suite file contents.
    """
    task_generator = GenerateSubSuites(evg_api, config_options)
    suites = task_generator.get_suites()

    config_dict_of_suites = task_generator.generate_suites_config(suites)
    config_dict_of_suites_and_tasks.update(config_dict_of_suites)

    task_generator.generate_task_config(shrub_config, suites)
Exemple #3
0
def _update_config_with_task(evg_api: EvergreenApi, build_variant: BuildVariant,
                             config_options: SelectedTestsConfigOptions,
                             config_dict_of_suites_and_tasks: Dict[str, str]) -> None:
    """
    Generate the suites config and the task shrub config for a given task config.

    :param evg_api: Evergreen API object.
    :param build_variant: Build variant to add tasks to.
    :param shrub_project: Shrub configuration for task.
    :param config_options: Task configuration options.
    :param config_dict_of_suites_and_tasks: Dict of shrub configs and suite file contents.
    """
    task_generator = GenerateSubSuites(evg_api, config_options)
    suites = task_generator.get_suites()

    config_dict_of_suites = task_generator.generate_suites_config(suites)
    config_dict_of_suites_and_tasks.update(config_dict_of_suites)

    task_generator.add_suites_to_build_variant(suites, build_variant)