Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add platform compatibility check for incremental build #4949

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/build_workflow/build_incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@

from manifests.build_manifest import BuildManifest
from manifests.input_manifest import InputManifest
from system.os import current_platform


class BuildIncremental:
def __init__(self, input_manifest: InputManifest, distribution: str):
def __init__(self, input_manifest: InputManifest, distribution: str, platform: str):
self.distribution = distribution
self.input_manifest = input_manifest
self.platform = platform or current_platform()

# Given input manifest and return a list of what components changed and added.
def commits_diff(self, input_manifest: InputManifest) -> List[str]:
Expand All @@ -31,6 +33,9 @@ def commits_diff(self, input_manifest: InputManifest) -> List[str]:
return [input_manifest.build.name.replace(" ", "-")]
components = []
for component in stable_input_manifest.components.select():
if component.platforms and self.platform not in component.platforms:
logging.info(f"Skipping {component.name} as it's not compatible on {self.platform}.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logging.info(f"Skipping {component.name} as it's not compatible on {self.platform}.")
logging.info(f"Skipping {component.name} as it is not compatible with {self.platform}.")

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks.

continue
if component.name not in previous_build_manifest.components:
components.append(component.name)
logging.info(f"Adding {component.name} since it is missing from previous build manifest")
Expand Down
2 changes: 1 addition & 1 deletion src/run_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def main() -> int:
output_dir = BuildOutputDir(manifest.build.filename, args.distribution).dir

if args.incremental:
buildIncremental = BuildIncremental(manifest, args.distribution)
buildIncremental = BuildIncremental(manifest, args.distribution, args.platform)
list_of_updated_plugins = buildIncremental.commits_diff(manifest)
components = buildIncremental.rebuild_plugins(list_of_updated_plugins, manifest)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_run_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_usage(self) -> None:
os.path.join(os.path.dirname(__file__), "tests_build_workflow", "data", "opensearch-dashboards-input-2.12.0.yml"))
BUILD_MANIFEST_DASHBOARDS = BuildManifest.from_path(
os.path.join(os.path.dirname(__file__), "tests_build_workflow", "data", "opensearch-dashboards-build-tar-2.12.0.yml"))
buildIncremental = BuildIncremental(INPUT_MANIFEST, "tar")
buildIncremental = BuildIncremental(INPUT_MANIFEST, "tar", "linux")

@patch("argparse._sys.argv", ["run_build.py", OPENSEARCH_MANIFEST, "-p", "linux"])
@patch("run_build.Builders.builder_from", return_value=MagicMock())
Expand Down
Loading
Loading