Repository: opensearch-project/opensearch-build

Issue:
[Bug]: Cron created by manifest workflow doesn't have build_platform parameter
### Describe the bug

Our manifest workflow will help us create input manifest and add the build job to our cron once we have a new version from OS or OSD core. e.g. #2894 

However since we start to build for different platform distribution, we would need to add build_platform parameters to trigger the build workflow which our current manifest workflow doesn't have. We would need to manually add the param to the cron in order to trigger it. #2911 

### To reproduce

When we have a new OS or OSD version, run `./manifest.sh update`

### Expected behavior

When the workflow raise the PR, it should also add this param to the cron. For different job type(OS or OSD), it would also add different platform parameter. e.g. for OS it should be `BUILD_PLATFORM=linux macos windows` but for OSD it's `BUILD_PLATFORM=linux windows`

### Screenshots

If applicable, add screenshots to help explain your problem.

### Host / Environment

_No response_

### Additional context

_No response_

### Relevant log output

_No response_


Discussion:
Should the scripts default to the full list of platforms instead and only have to specify which platforms to build when it's not all 3?

Resolving patch:
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
@@ -24,6 +24,11 @@
 
 
 class InputManifests(Manifests):
+    BUILD_PLATFORM = {
+        "opensearch": "linux macos windows",
+        "opensearch-dashboards": "linux windows"
+    }
+
     def __init__(self, name: str) -> None:
         self.name = name
         self.prefix = name.lower().replace(" ", "-")
@@ -164,7 +169,11 @@ def add_to_cron(self, version: str) -> None:
         with open(jenkinsfile, "r") as f:
             data = f.read()
 
-        cron_entry = f"H 1 * * * %INPUT_MANIFEST={version}/{self.prefix}-{version}.yml;TARGET_JOB_NAME=distribution-build-{self.prefix}\n"
+        build_platform = self.BUILD_PLATFORM.get(self.prefix, "linux")
+
+        cron_entry = f"H 1 * * * %INPUT_MANIFEST={version}/{self.prefix}-{version}.yml;" \
+                     f"TARGET_JOB_NAME=distribution-build-{self.prefix};" \
+                     f"BUILD_PLATFORM={build_platform}\n"
 
         if cron_entry in data:
             raise ValueError(f"{jenkinsfile} already contains an entry for {self.prefix} {version}")


Test patch:
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
@@ -125,7 +125,8 @@ def test_add_to_cron(self, mock_open: MagicMock) -> None:
         mock_open.assert_has_calls([call(InputManifests.cron_jenkinsfile(), 'w')])
         mock_open.assert_has_calls([call(InputManifests.cron_jenkinsfile(), 'r')])
         mock_open().write.assert_called_once_with(
-            f"parameterizedCron '''\n{' ' * 12}H 1 * * * %INPUT_MANIFEST=0.1.2/test-0.1.2.yml;TARGET_JOB_NAME=distribution-build-test\n"
+            f"parameterizedCron '''\n{' ' * 12}H 1 * * * %INPUT_MANIFEST=0.1.2/test-0.1.2.yml;"
+            f"TARGET_JOB_NAME=distribution-build-test;BUILD_PLATFORM=linux\n"
         )
 
     def test_versionincrement_workflow(self) -> None: