forked from opensearch-project/opensearch-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
component_opensearch_dashboards_min.py
43 lines (35 loc) · 1.43 KB
/
component_opensearch_dashboards_min.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
import os
from typing import Any, List
from git.git_repository import GitRepository
from manifests_workflow.component import Component
from system.config_file import ConfigFile
class ComponentOpenSearchDashboardsMin(Component):
def __init__(self, repo: GitRepository, snapshot: bool = False) -> None:
super().__init__("OpenSearch-Dashboards", repo, snapshot, [])
@classmethod
def branches(self, url: str = "https://github.com/opensearch-project/OpenSearch-Dashboards.git") -> List[str]:
return Component.branches(url)
@classmethod
def checkout(self, path: str, branch: str = "main", snapshot: bool = False) -> 'ComponentOpenSearchDashboardsMin':
with GitRepository(
"https://github.com/opensearch-project/OpenSearch-Dashboards.git",
branch,
path,
) as repo:
return ComponentOpenSearchDashboardsMin(
repo,
snapshot,
)
@property
def properties(self) -> ConfigFile:
path = os.path.join(self.git_repo.working_directory, "package.json")
return ConfigFile.from_file(path)
@property
def version(self) -> Any:
return self.properties.get_value("version")