From fb752db91adcab5fcf35f4f38c75a3d395a6db43 Mon Sep 17 00:00:00 2001 From: jamshale Date: Mon, 22 Jul 2024 13:08:15 -0700 Subject: [PATCH] README update and another exclude condition in repo_manager Signed-off-by: jamshale --- README.md | 10 ++++++++++ repo_manager.py | 27 ++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 22c432398..dcca51e74 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,16 @@ A script was developed to help with maitenance of the repo called `repo_manager. Run `python repo_manager.py` and you will be met with 2 options. - (1) Is used for starting or adding a new plugin. It will generate all the common scaffolding for a plugin which has the expected format. - (2) Is used for updating and changing common poetry dependencies and configurations. It takes the poetry sections in the `pyproject.toml` files from the `plugin_globals` directory and combines them with the local plugin poetry sections. For the dependencies the common will be overridden by the globals. The other config sections will be replaced by the global configs. Then the lock files will be removed and re-installed. + - (3) Is used for updating the plugin versions in the `plugin_globals` directory. It will update the versions of the plugins in the `plugin_globals` directory to the latest version on the main branch of the plugin repo. It will also update the `plugin_globals` directory to the latest version on the main branch of the plugin repo. + - (4) This option is used by the CI/CD release pipeline. It updates the release notes and the individual plugins with a new version of aries_cloudagent. + - (5) This option is also used by the CI/CD release pipeline. It gets any plugins that have succeeded the tests after a new version of aries_cloudagent has been released if their changes were not reverted than the plugin has been updated to the new version of aries_cloudagent. + - (6) This option will run a general update for all poetry lock files in all plugins. + - (7) This option is used for upgrading a particular library for all plugins. It's useful for when you don't want to do a general upgrade for every library. + +## Lite plugins + +Sometimes is desirable to have a plugin that doesn't need integration tests or extra scaffholding. However, we need a way to avoid these plugins running integration tests in the CI/CD pipeline. To do this, we can simple add the plugin name to the `lite_plugins` file. Which is a line seperated list of plugin names. +``` ## Plugin Documentation diff --git a/repo_manager.py b/repo_manager.py index c4aa06d5a..37ea94803 100644 --- a/repo_manager.py +++ b/repo_manager.py @@ -284,20 +284,27 @@ def replace_global_sections(name: str) -> None: """ global_sections, plugin_sections = get_and_combine_main_poetry_sections(name) process_main_config_sections(name, plugin_sections, global_sections) - global_sections, plugin_sections = get_and_combine_integration_poetry_sections(name) - process_integration_config_sections(name, plugin_sections, global_sections) + if is_plugin_directory(name, True): + global_sections, plugin_sections = get_and_combine_integration_poetry_sections(name) + process_integration_config_sections(name, plugin_sections, global_sections) -def is_plugin_directory(plugin_name: str) -> bool: +def is_plugin_directory(plugin_name: str, exclude_lite_plugins: bool = False) -> bool: # If there is a directory which is not a plugin it should be ignored here - lite_plugins = Path('lite_plugins').read_text().splitlines() + if exclude_lite_plugins: + lite_plugins = Path('lite_plugins').read_text().splitlines() + return ( + os.path.isdir(plugin_name) + and plugin_name != GLOBAL_PLUGIN_DIR + and not plugin_name.startswith(".") + and plugin_name not in lite_plugins + ) return ( os.path.isdir(plugin_name) and plugin_name != GLOBAL_PLUGIN_DIR and not plugin_name.startswith(".") - and plugin_name not in lite_plugins ) - + def update_all_poetry_locks(): for root, _, files in os.walk("."): @@ -367,9 +374,11 @@ def main(arg_1=None, arg_2=None): print(f"Updating common poetry sections in {plugin_name}\n") replace_global_sections(plugin_name) os.system(f"cd {plugin_name} && rm poetry.lock && poetry lock") - os.system( - f"cd {plugin_name}/integration && rm poetry.lock && poetry lock" - ) + # Don't update lite plugin integration files (They don't have any) + if is_plugin_directory(plugin_name, True): + os.system( + f"cd {plugin_name}/integration && rm poetry.lock && poetry lock" + ) elif selection == "3": # Upgrade plugin globals lock file