Repository: opensearch-project/opensearch-build

Issue:
[Enhancement] OS/OSD runner is not separated in manifest_workflow and reduce runtime
We want OS and OSD runner to be separated when workflow create the new manifest file.
As of now both os and osd runner are pointing to the same one.
There are different configurations between the two runners.

The workflow also runs for way too long.
gradle properties does not require a gradle mavelocal to run beforehand.

Plus, gradle 7.x cannot build OS 1.0 anyway and will fail the workflow in the middle.

Thanks.



Discussion:

Resolving patch:
diff --git a/src/manifests_workflow/component_opensearch_min.py b/src/manifests_workflow/component_opensearch_min.py
--- a/src/manifests_workflow/component_opensearch_min.py
+++ b/src/manifests_workflow/component_opensearch_min.py
@@ -32,10 +32,6 @@ def checkout(self, path: str, branch: str = "main", snapshot: bool = False) -> '
             snapshot,
         )
 
-    def publish_to_maven_local(self) -> None:
-        cmd = ComponentOpenSearch.gradle_cmd("publishToMavenLocal", {"build.snapshot": str(self.snapshot).lower()})
-        self.git_repo.execute_silent(cmd)
-
     @property
     def properties(self) -> PropertiesFile:
         cmd = ComponentOpenSearch.gradle_cmd("properties", {"build.snapshot": str(self.snapshot).lower()})
@@ -43,5 +39,4 @@ def properties(self) -> PropertiesFile:
 
     @property
     def version(self) -> Any:
-        self.publish_to_maven_local()
         return self.properties.get_value("version")
diff --git a/src/manifests_workflow/input_manifests.py b/src/manifests_workflow/input_manifests.py
--- a/src/manifests_workflow/input_manifests.py
+++ b/src/manifests_workflow/input_manifests.py
@@ -106,6 +106,11 @@ def update(self, min_klass: Union[Type[ComponentOpenSearchMin], Type[ComponentOp
                 self.add_to_cron(release_version)
 
     def create_manifest(self, version: str, components: List = []) -> InputManifest:
+        image_map = {
+            "opensearch": "opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v1",
+            "opensearch-dashboards": "opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build-v1"
+        }
+
         data: Dict = {
             "schema-version": "1.0",
             "build": {
@@ -114,7 +119,7 @@ def create_manifest(self, version: str, components: List = []) -> InputManifest:
             },
             "ci": {
                 "image": {
-                    "name": "opensearchstaging/ci-runner:ci-runner-centos7-v1"
+                    "name": image_map[self.prefix]
                 }
             },
             "components": [],


Test patch:
diff --git a/tests/tests_manifests_workflow/test_component_opensearch_min.py b/tests/tests_manifests_workflow/test_component_opensearch_min.py
--- a/tests/tests_manifests_workflow/test_component_opensearch_min.py
+++ b/tests/tests_manifests_workflow/test_component_opensearch_min.py
@@ -28,12 +28,6 @@ def test_checkout(self, *mocks: MagicMock) -> None:
         self.assertEqual(component.name, "OpenSearch")
         self.assertFalse(component.snapshot)
 
-    def test_publish_to_maven_local(self) -> None:
-        component = ComponentOpenSearchMin(MagicMock())
-        component.publish_to_maven_local()
-        execute_silent = unittest.mock.create_autospec(component.git_repo.execute_silent)
-        execute_silent.assert_called_with("./gradlew publishToMavenLocal -Dbuild.snapshot=false")
-
     def test_version(self) -> None:
         repo = MagicMock()
         repo.output.return_value = "version=2.1"
diff --git a/tests/tests_manifests_workflow/test_input_manifests.py b/tests/tests_manifests_workflow/test_input_manifests.py
--- a/tests/tests_manifests_workflow/test_input_manifests.py
+++ b/tests/tests_manifests_workflow/test_input_manifests.py
@@ -16,27 +16,39 @@ def test_manifests_path(self) -> None:
         path = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "manifests"))
         self.assertEqual(path, InputManifests.manifests_path())
 
-    def test_create_manifest(self) -> None:
-        input_manifests = InputManifests("test")
+    def test_create_manifest_opensearch(self) -> None:
+        input_manifests = InputManifests("opensearch")
+        input_manifest = input_manifests.create_manifest("1.2.3", [])
+        self.assertEqual(
+            input_manifest.to_dict(),
+            {
+                "schema-version": "1.0",
+                "build": {"name": "opensearch", "version": "1.2.3"},
+                "ci": {"image": {"name": "opensearchstaging/ci-runner:ci-runner-centos7-opensearch-build-v1"}},
+            },
+        )
+
+    def test_create_manifest_opensearch_dashboards(self) -> None:
+        input_manifests = InputManifests("opensearch-dashboards")
         input_manifest = input_manifests.create_manifest("1.2.3", [])
         self.assertEqual(
             input_manifest.to_dict(),
             {
                 "schema-version": "1.0",
-                "build": {"name": "test", "version": "1.2.3"},
-                "ci": {"image": {"name": "opensearchstaging/ci-runner:ci-runner-centos7-v1"}},
+                "build": {"name": "opensearch-dashboards", "version": "1.2.3"},
+                "ci": {"image": {"name": "opensearchstaging/ci-runner:ci-runner-centos7-opensearch-dashboards-build-v1"}},
             },
         )
 
     @patch("os.makedirs")
     @patch("manifests_workflow.input_manifests.InputManifests.create_manifest")
     def test_write_manifest(self, mock_create_manifest: MagicMock, mock_makedirs: MagicMock) -> None:
-        input_manifests = InputManifests("test")
+        input_manifests = InputManifests("opensearch")
         input_manifests.write_manifest('0.1.2', [])
         mock_create_manifest.assert_called_with('0.1.2', [])
         mock_makedirs.assert_called_with(os.path.join(InputManifests.manifests_path(), '0.1.2'), exist_ok=True)
         mock_create_manifest.return_value.to_file.assert_called_with(
-            os.path.join(InputManifests.manifests_path(), '0.1.2', 'test-0.1.2.yml')
+            os.path.join(InputManifests.manifests_path(), '0.1.2', 'opensearch-0.1.2.yml')
         )
 
     def test_jenkins_path(self) -> None: