From a9fc21dddd82d828886430781e371a09c795ed79 Mon Sep 17 00:00:00 2001 From: Jack Pierce Date: Sun, 3 Apr 2022 21:49:53 -0400 Subject: [PATCH 1/3] Update README.md --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d84d452..2f55ed1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,11 @@ -# gator -Propagator CLI + Package +# Abouut Gator + +Gator is short for "change propagator", and can be used to make changes across multiple Github repositories at once. + +# Development Status + +Gator has not reached Minimum Viable Product status yet, but is actively in development as of early 2022. + +# Contributing + +If you're interested in contributing, please check out the CONTRIBUTING.md file at repo root. From 38142b58b4c0d73ff5d60deb61df195d5184e19d Mon Sep 17 00:00:00 2001 From: Jack Pierce Date: Sun, 3 Apr 2022 21:59:07 -0400 Subject: [PATCH 2/3] Update README.md --- README.md | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f55ed1..66e0108 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,41 @@ -# Abouut Gator +# About Gator Gator is short for "change propagator", and can be used to make changes across multiple Github repositories at once. +The entrypoint will be a dockerized CLI and a python package. + +You will give Gator an imperative yaml spec file, and some repos to process. Gator will create PRs or Issues in Github according to the spec. The CLI will allow you to test your specs locally, making sure that the code changes look as you expect before PRs are created. + +If the reusable code modifications do not suffice, you will be able to make changes to code programatically, and use Gator to automate the git aspects, and assist you with testing. An example `Changeset` specification will look like this: + +```yaml +kind: Changeset +version: v1alpha +spec: + name: Docker image registry migration + issue_title: Replace all usages of outdated Docker image registry URL with new URL + issue_body: | + # Artifactory Has Moved + + ... Some text to be included in the PR or issue body. + filters: + - kind: RegexFilter + version: v1alpha + spec: + regex: 'registry.company.com' + paths: + - definitions/application_spec.yml + code_changes: + - kind: RegexReplaceCodeChange + version: v1alpha + spec: + replacement_details: + - regex: 'registry.company.com' + replace_term: "registry.parent-company.com" + paths: + - definitions/application_spec.yml +``` + # Development Status Gator has not reached Minimum Viable Product status yet, but is actively in development as of early 2022. From 2221c7264121626159ddc1b836f3d571c171daa9 Mon Sep 17 00:00:00 2001 From: Jack Pierce Date: Sun, 3 Apr 2022 22:32:48 -0400 Subject: [PATCH 3/3] Update some docstrings, remove unused test file --- gator/constants.py | 7 ------- gator/resources/build.py | 12 ++++++++++-- tests/resources/test_changeset.py | 0 3 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 tests/resources/test_changeset.py diff --git a/gator/constants.py b/gator/constants.py index dc3f869..e3a91ec 100644 --- a/gator/constants.py +++ b/gator/constants.py @@ -1,12 +1,5 @@ import re -# Resource Values -RESOURCE_KIND_GENERIC = "GenericResource" -RESOURCE_VERSION_UNUSABLE = "Unusable" - - DEFAULT_REGEX_MODES = re.MULTILINE - GIT_INTERNALS_DIRECTORY = ".git" - VERSION_V1_ALPHA = "v1alpha" diff --git a/gator/resources/build.py b/gator/resources/build.py index 93f40fb..a1d8fa3 100644 --- a/gator/resources/build.py +++ b/gator/resources/build.py @@ -26,7 +26,13 @@ class _ResourceWithValidation(GatorResource): - """Define a subclass of Gator Resource that tricks""" + """ + Define a subclass of Gator Resource for Pydantic deserialization purposes. + + This subclass uses Pydantic validators to look up the classes associated + with given resource names in a registry, allowing deserialization of + resources not present in the registry at import time (Custom Resources). + """ @classmethod def __get_validators__(cls): @@ -45,6 +51,7 @@ def return_kind(cls, values): class ChangesetSpecV1AlphaSpec(BaseModelForbidExtra): + """Changeset Specification.""" name: str issue_title: Optional[str] issue_body: Optional[str] @@ -53,6 +60,7 @@ class ChangesetSpecV1AlphaSpec(BaseModelForbidExtra): class Changeset(BaseModelForbidExtra): + """Define Changeset.""" kind = "Changeset" version = "v1alpha" spec: ChangesetSpecV1AlphaSpec @@ -107,7 +115,7 @@ def register_custom_resource(resource_class: Type) -> None: """ Register a custom Gator resource. - Use this function to register a custom resource with Gator. This + Use this function to register a custom resource with Gator. :param resource_class: Pydantic class, extending CodeChangeResource or FilterResource, that contains the business logic for executing the resource """ diff --git a/tests/resources/test_changeset.py b/tests/resources/test_changeset.py deleted file mode 100644 index e69de29..0000000