Skip to content

Commit

Permalink
README update and another exclude condition in repo_manager
Browse files Browse the repository at this point in the history
Signed-off-by: jamshale <[email protected]>
  • Loading branch information
jamshale committed Jul 22, 2024
1 parent 2371ac7 commit fb752db
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 18 additions & 9 deletions repo_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("."):
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fb752db

Please sign in to comment.