Skip to content

Commit 29cfb0e

Browse files
committed
Add checks to OpenSearch in auto-generated manifests.
Signed-off-by: dblock <[email protected]>
1 parent d3519a6 commit 29cfb0e

File tree

5 files changed

+44
-9
lines changed

5 files changed

+44
-9
lines changed

bundle-workflow/src/manifests_workflow/component.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,28 @@
44
# this file be licensed under the Apache-2.0 license or a
55
# compatible open source license.
66

7+
from manifests.manifest import Manifest
8+
79

810
class Component:
9-
def __init__(self, name, repo, snapshot=False):
11+
def __init__(self, name, repo, snapshot=False, checks=[]):
1012
self.name = name
1113
self.git_repo = repo
1214
self.snapshot = snapshot
15+
self.checks = checks
1316

1417
@classmethod
1518
def gradle_cmd(self, target, props={}):
1619
cmd = [f"./gradlew {target}"]
1720
cmd.extend([f"-D{k}={v}" for k, v in props.items()])
1821
return " ".join(cmd)
22+
23+
def to_dict(self):
24+
return Manifest.compact(
25+
{
26+
"name": self.name,
27+
"repository": self.git_repo.url,
28+
"ref": self.git_repo.ref,
29+
"checks": self.checks,
30+
}
31+
)

bundle-workflow/src/manifests_workflow/component_opensearch_min.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414

1515
class ComponentOpenSearchMin(Component):
1616
def __init__(self, repo, snapshot=False):
17-
super().__init__("OpenSearch", repo, snapshot)
17+
super().__init__(
18+
"OpenSearch",
19+
repo,
20+
snapshot,
21+
["gradle:publish", "gradle:properties:version"],
22+
)
1823

1924
@classmethod
2025
def get_branches(self):

bundle-workflow/src/manifests_workflow/input_manifests.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,7 @@ def update(self, keep=False):
107107
# TODO: copy OpenSearch and common-utils from the previous manifest
108108
for component in main_versions[release_version]:
109109
logging.info(f" Adding {component.name}")
110-
data["components"].append(
111-
{
112-
"name": component.name,
113-
"repository": component.git_repo.url,
114-
"ref": component.git_repo.ref,
115-
}
116-
)
110+
data["components"].append(component.to_dict())
117111

118112
manifest = InputManifest(data)
119113
manifest_path = os.path.join(

bundle-workflow/tests/tests_manifests_workflow/test_component_opensearch.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@ def test_properties(self):
3030
repo.output.return_value = "version=2.1"
3131
component = ComponentOpenSearch("common-utils", repo, "1.1.0")
3232
self.assertEqual(component.properties.get_value("version"), "2.1")
33+
34+
def test_to_dict(self):
35+
repo = MagicMock(ref="ref", url="repo")
36+
repo.output.return_value = "version=2.1"
37+
component = ComponentOpenSearch("common-utils", repo, "1.1.0")
38+
self.assertEqual(
39+
component.to_dict(),
40+
{"name": "common-utils", "ref": "ref", "repository": "repo"},
41+
)

bundle-workflow/tests/tests_manifests_workflow/test_component_opensearch_min.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,17 @@ def test_properties(self):
5050
repo.output.return_value = "version=2.1"
5151
component = ComponentOpenSearchMin(repo)
5252
self.assertEqual(component.properties.get_value("version"), "2.1")
53+
54+
def test_to_dict(self):
55+
repo = MagicMock(ref="ref", url="repo")
56+
repo.output.return_value = "version=2.1"
57+
component = ComponentOpenSearchMin(repo)
58+
self.assertEqual(
59+
component.to_dict(),
60+
{
61+
"checks": ["gradle:publish", "gradle:properties:version"],
62+
"name": "OpenSearch",
63+
"ref": "ref",
64+
"repository": "repo",
65+
},
66+
)

0 commit comments

Comments
 (0)