From 040ca0f3d257e54e997633da13e1aa98eb6c7b9a Mon Sep 17 00:00:00 2001 From: Zelin Hao Date: Wed, 27 Jul 2022 12:02:21 -0700 Subject: [PATCH] More changes Signed-off-by: Zelin Hao --- .github/workflows/manifests.yml | 3 ++- .../opensearch-dashboards/1.x/manifest.yml | 4 ++-- .../opensearch-dashboards/2.x/manifest.yml | 4 ++-- .../opensearch-dashboards/3.x/manifest.yml | 2 +- .../opensearch-dashboards/default/manifest.yml | 4 ++-- manifests/templates/opensearch/1.x/manifest.yml | 4 ++-- manifests/templates/opensearch/2.x/manifest.yml | 4 ++-- manifests/templates/opensearch/3.x/manifest.yml | 2 +- .../templates/opensearch/default/manifest.yml | 2 +- src/manifests_workflow/component.py | 7 ++++++- src/manifests_workflow/component_opensearch.py | 2 +- .../component_opensearch_dashboards_min.py | 2 +- src/manifests_workflow/component_opensearch_min.py | 2 +- src/manifests_workflow/input_manifests.py | 14 +++++++------- .../input_manifests_opensearch.py | 9 +++------ .../input_manifests_opensearch_dashboards.py | 9 +++------ 16 files changed, 37 insertions(+), 37 deletions(-) diff --git a/.github/workflows/manifests.yml b/.github/workflows/manifests.yml index 2166c2fca3..4495916b3b 100644 --- a/.github/workflows/manifests.yml +++ b/.github/workflows/manifests.yml @@ -5,7 +5,8 @@ on: push: pull_request: paths: - - manifests/**/*.yml + - 'manifests/**/*.yml' + - '!manifests/templates/**/' schedule: - cron: 0 0 * * * diff --git a/manifests/templates/opensearch-dashboards/1.x/manifest.yml b/manifests/templates/opensearch-dashboards/1.x/manifest.yml index 8433c24c76..ef01447725 100644 --- a/manifests/templates/opensearch-dashboards/1.x/manifest.yml +++ b/manifests/templates/opensearch-dashboards/1.x/manifest.yml @@ -2,11 +2,11 @@ schema-version: '1.0' build: name: OpenSearch Dashboards - version: 1.3.4 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build-v2 components: - name: OpenSearch-Dashboards repository: https://github.com/opensearch-project/OpenSearch-Dashboards.git - ref: tags/1.3.4 + ref: main diff --git a/manifests/templates/opensearch-dashboards/2.x/manifest.yml b/manifests/templates/opensearch-dashboards/2.x/manifest.yml index a834cceb30..9074cf5d0b 100644 --- a/manifests/templates/opensearch-dashboards/2.x/manifest.yml +++ b/manifests/templates/opensearch-dashboards/2.x/manifest.yml @@ -2,13 +2,13 @@ schema-version: '1.0' build: name: OpenSearch Dashboards - version: 2.1.0 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build-v2 components: - name: OpenSearch-Dashboards repository: https://github.com/opensearch-project/OpenSearch-Dashboards.git - ref: tags/2.1.0 + ref: main checks: - npm:package:version diff --git a/manifests/templates/opensearch-dashboards/3.x/manifest.yml b/manifests/templates/opensearch-dashboards/3.x/manifest.yml index eb298b4398..ef01447725 100644 --- a/manifests/templates/opensearch-dashboards/3.x/manifest.yml +++ b/manifests/templates/opensearch-dashboards/3.x/manifest.yml @@ -2,7 +2,7 @@ schema-version: '1.0' build: name: OpenSearch Dashboards - version: 3.0.0 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build-v2 diff --git a/manifests/templates/opensearch-dashboards/default/manifest.yml b/manifests/templates/opensearch-dashboards/default/manifest.yml index a834cceb30..9074cf5d0b 100644 --- a/manifests/templates/opensearch-dashboards/default/manifest.yml +++ b/manifests/templates/opensearch-dashboards/default/manifest.yml @@ -2,13 +2,13 @@ schema-version: '1.0' build: name: OpenSearch Dashboards - version: 2.1.0 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build-v2 components: - name: OpenSearch-Dashboards repository: https://github.com/opensearch-project/OpenSearch-Dashboards.git - ref: tags/2.1.0 + ref: main checks: - npm:package:version diff --git a/manifests/templates/opensearch/1.x/manifest.yml b/manifests/templates/opensearch/1.x/manifest.yml index 66c1597bad..a1934229d4 100644 --- a/manifests/templates/opensearch/1.x/manifest.yml +++ b/manifests/templates/opensearch/1.x/manifest.yml @@ -2,7 +2,7 @@ schema-version: '1.0' build: name: OpenSearch - version: 1.3.4 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2 @@ -10,7 +10,7 @@ ci: components: - name: OpenSearch repository: https://github.com/opensearch-project/OpenSearch.git - ref: tags/1.3.4 + ref: main checks: - gradle:publish - gradle:properties:version diff --git a/manifests/templates/opensearch/2.x/manifest.yml b/manifests/templates/opensearch/2.x/manifest.yml index f772793f33..d798342efe 100644 --- a/manifests/templates/opensearch/2.x/manifest.yml +++ b/manifests/templates/opensearch/2.x/manifest.yml @@ -2,7 +2,7 @@ schema-version: '1.0' build: name: OpenSearch - version: 2.1.0 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2 @@ -10,7 +10,7 @@ ci: components: - name: OpenSearch repository: https://github.com/opensearch-project/OpenSearch.git - ref: tags/2.1.0 + ref: main checks: - gradle:publish - gradle:properties:version diff --git a/manifests/templates/opensearch/3.x/manifest.yml b/manifests/templates/opensearch/3.x/manifest.yml index 07d8434d7d..d798342efe 100644 --- a/manifests/templates/opensearch/3.x/manifest.yml +++ b/manifests/templates/opensearch/3.x/manifest.yml @@ -2,7 +2,7 @@ schema-version: '1.0' build: name: OpenSearch - version: 3.0.0 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2 diff --git a/manifests/templates/opensearch/default/manifest.yml b/manifests/templates/opensearch/default/manifest.yml index 508bf2134a..d798342efe 100644 --- a/manifests/templates/opensearch/default/manifest.yml +++ b/manifests/templates/opensearch/default/manifest.yml @@ -2,7 +2,7 @@ schema-version: '1.0' build: name: OpenSearch - version: 2.1.0 + version: 'replace' ci: image: name: opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v2 diff --git a/src/manifests_workflow/component.py b/src/manifests_workflow/component.py index ea07832077..8194266c05 100644 --- a/src/manifests_workflow/component.py +++ b/src/manifests_workflow/component.py @@ -28,4 +28,9 @@ def branches(self, url: str) -> List[str]: return branches def to_dict(self) -> Any: - return Manifest.compact({"name": self.name, "repository": self.git_repo.url, "ref": self.git_repo.ref, "checks": self.checks}) + return Manifest.compact({ + "name": self.name, + "repository": self.git_repo.url, + "ref": self.git_repo.ref, + "checks": self.checks + }) diff --git a/src/manifests_workflow/component_opensearch.py b/src/manifests_workflow/component_opensearch.py index 48664e408c..c1ed3d4b00 100644 --- a/src/manifests_workflow/component_opensearch.py +++ b/src/manifests_workflow/component_opensearch.py @@ -23,7 +23,7 @@ def checkout( branch: str = "main", snapshot: bool = False, working_directory: str = None, - ) -> "ComponentOpenSearch": + ) -> 'ComponentOpenSearch': with GitRepository( f"https://github.com/opensearch-project/{name}.git", branch, diff --git a/src/manifests_workflow/component_opensearch_dashboards_min.py b/src/manifests_workflow/component_opensearch_dashboards_min.py index d81b422ec3..9c85f1ccc1 100644 --- a/src/manifests_workflow/component_opensearch_dashboards_min.py +++ b/src/manifests_workflow/component_opensearch_dashboards_min.py @@ -21,7 +21,7 @@ def branches(self, url: str = "https://github.com/opensearch-project/OpenSearch- return Component.branches(url) @classmethod - def checkout(self, path: str, branch: str = "main", snapshot: bool = False) -> "ComponentOpenSearchDashboardsMin": + def checkout(self, path: str, branch: str = "main", snapshot: bool = False) -> 'ComponentOpenSearchDashboardsMin': with GitRepository( "https://github.com/opensearch-project/OpenSearch-Dashboards.git", branch, diff --git a/src/manifests_workflow/component_opensearch_min.py b/src/manifests_workflow/component_opensearch_min.py index fbf8b73aad..3667ac0b7e 100644 --- a/src/manifests_workflow/component_opensearch_min.py +++ b/src/manifests_workflow/component_opensearch_min.py @@ -26,7 +26,7 @@ def branches(self, url: str = "https://github.com/opensearch-project/OpenSearch. return Component.branches(url) @classmethod - def checkout(self, path: str, branch: str = "main", snapshot: bool = False) -> "ComponentOpenSearchMin": + def checkout(self, path: str, branch: str = "main", snapshot: bool = False) -> 'ComponentOpenSearchMin': return ComponentOpenSearchMin( GitRepository("https://github.com/opensearch-project/OpenSearch.git", branch, path), snapshot, diff --git a/src/manifests_workflow/input_manifests.py b/src/manifests_workflow/input_manifests.py index a4c4f9a6f8..f1dee86fd3 100644 --- a/src/manifests_workflow/input_manifests.py +++ b/src/manifests_workflow/input_manifests.py @@ -114,20 +114,20 @@ def create_manifest(self, version: str, components: List = []) -> InputManifest: templates_base_path = os.path.join(self.manifests_path(), "templates") template_version_folder = version.split(".")[0] + ".x" template_full_path = os.path.join(templates_base_path, self.prefix, template_version_folder, "manifest.yml") - if os.path.exists(template_full_path): - input_manifest_templates = InputManifest.from_file(open(template_full_path)) - else: - input_manifest_templates = InputManifest.from_file(open(os.path.join(templates_base_path, self.prefix, "default", "manifest.yml"))) + if not os.path.exists(template_full_path): + template_full_path = os.path.join(templates_base_path, self.prefix, "default", "manifest.yml") - input_manifest_templates.build.version = version + manifest = InputManifest.from_file(open(template_full_path)) + + manifest.build.version = version manifests_components = [] for component in components: logging.info(f" Adding {component.name}") manifests_components.append(component.to_dict()) - input_manifest_templates.components = InputComponents(manifests_components) # type: ignore - return input_manifest_templates + manifest.components = InputComponents(manifests_components) # type: ignore + return manifest def write_manifest(self, version: str, components: List = []) -> None: logging.info(f"Creating new version: {version}") diff --git a/src/manifests_workflow/input_manifests_opensearch.py b/src/manifests_workflow/input_manifests_opensearch.py index a693ae3537..2c20ef5b38 100644 --- a/src/manifests_workflow/input_manifests_opensearch.py +++ b/src/manifests_workflow/input_manifests_opensearch.py @@ -19,10 +19,7 @@ def __init__(self) -> None: def files(self, name: str = "opensearch") -> List: return InputManifests.files(name) - def update( - self, - min_klass: Union[Type[ComponentOpenSearchMin], Type[ComponentOpenSearchDashboardsMin]] = ComponentOpenSearchMin, - component_klass: Type[ComponentOpenSearch] = ComponentOpenSearch, - keep: bool = False, - ) -> None: + def update(self, min_klass: Union[Type[ComponentOpenSearchMin], Type[ComponentOpenSearchDashboardsMin]] = + ComponentOpenSearchMin, component_klass: Type[ComponentOpenSearch] = ComponentOpenSearch, + keep: bool = False) -> None: super().update(min_klass=ComponentOpenSearchMin, component_klass=ComponentOpenSearch, keep=keep) diff --git a/src/manifests_workflow/input_manifests_opensearch_dashboards.py b/src/manifests_workflow/input_manifests_opensearch_dashboards.py index 4234b97feb..a0515fb47b 100644 --- a/src/manifests_workflow/input_manifests_opensearch_dashboards.py +++ b/src/manifests_workflow/input_manifests_opensearch_dashboards.py @@ -19,10 +19,7 @@ def __init__(self) -> None: def files(self, name: str = "opensearch-dashboards") -> List: return InputManifests.files(name) - def update( - self, - min_klass: Union[Type[ComponentOpenSearchMin], Type[ComponentOpenSearchDashboardsMin]] = ComponentOpenSearchDashboardsMin, - component_klass: Type[ComponentOpenSearch] = None, - keep: bool = False, - ) -> None: + def update(self, min_klass: Union[Type[ComponentOpenSearchMin], Type[ComponentOpenSearchDashboardsMin]] = + ComponentOpenSearchDashboardsMin, component_klass: Type[ComponentOpenSearch] = None, + keep: bool = False) -> None: super().update(min_klass=ComponentOpenSearchDashboardsMin, component_klass=None, keep=keep)