Skip to content

Conversation

aravindkesavan
Copy link

Description

This PR adds a --dry-run option to the assemble tool to support non-destructive runs, allowing users to simulate the assembly process without downloading or extracting artifacts. Additionally, it introduces the capability to generate a manifest file dynamically via the --generate-manifest option.

With these enhancements, users can:

  • Dynamically generate a manifest YAML file with customizable parameters such as version, platform, architecture, distribution, and component.
  • Perform dry runs using an existing or dynamically generated manifest to validate the assemble logic safely without modifying disk or network state.

Generate a Manifest File Dynamically

Run the following command to create a manifest file named dry-run-manifest.yml with your desired parameters (all optional):

Generate a new manifest file for version 2.14.0:

python src/run_assemble.py --generate-manifest output-manifest.yml --version 2.14.0 --platform linux --arch x64 --dist tar --component opensearch

Using the below command to run the assemble tool in dry-run mode with the generated manifest:

python3 src/run_assemble.py dry-run-manifest.yml --dry-run

Other enhancements include new command-line arguments to specify version, platform, architecture, distribution type, and component name for the manifest generation feature.

Issues Resolved

  • Adds safer testing and debugging capabilities for the assemble workflow.
  • Provides dynamic manifest generation to simplify build and release workflows.
  • Improves CLI usability and feature set.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@aravindkesavan
Copy link
Author

@gaiksaya Could you please review this feature and provide your opinion on the next GO

@gaiksaya
Copy link
Member

gaiksaya commented Jun 16, 2025

@gaiksaya Could you please review this feature and provide your opinion on the next GO

Will do in next few days. Just returned from my vacation today so catching up.

Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

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

Thanks for contribution.
Tho I have a few doubt about this PR.

Thanks.

version = args.version or "0.0.1"
dist = args.dist or "tar"

url = f"https://artifacts.opensearch.org/releases/bundle/{component}/{version}/{component}-{version}-{platform_name}-{arch}.{dist}"
Copy link
Member

Choose a reason for hiding this comment

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

We should not hard code this to prod url as if you see other similar features, we only use prod url substitutions in Jenkins lib. As opensearch-build was meant to run in any env and expected the files to be linked to local file paths.

Comment on lines +36 to +38
```bash
python src/run_assemble.py <manifest-file> [options]
```
Copy link
Member

Choose a reason for hiding this comment

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

I do not think specifying this as we use the shell script as entrypoint with everything linked to pipenv.
This would add up confusions and remove the abstraction layer.
Users may not installed all the libs beforehand.

Comment on lines +42 to +55
#### CLI Flags

| Option | Description |
|--------------------------|-----------------------------------------------------------------------------|
| `--generate-manifest` | Generate a manifest YAML file dynamically (default filename: `manifest.yml`). |
| `--dry-run` | Simulate the assemble step without downloading or extracting artifacts. |
| `--version` | OpenSearch version (e.g., `2.14.0`). Used with `--generate-manifest`. |
| `--platform` | Target platform (`linux`, `windows`, `macos`). |
| `--arch` | Target architecture (`x64`, `arm64`). |
| `--dist` | Distribution type (`tar`, `zip`, `rpm`). |
| `--component` | Component name (defaults to `opensearch`). |
| `-b`, `--base-url` | Base URL to download artifacts from. |
| `--keep` | Do not delete the working temporary directory. |
| `-v`, `--verbose` | Enable verbose logging. |
Copy link
Member

Choose a reason for hiding this comment

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

These could be add in the similar chart above when discussing assemble.sh.

Comment on lines +57 to +75
#### Examples

**Assemble using an existing manifest:**

```bash
python src/run_assemble.py builds/opensearch/manifest.yml --verbose
```

**Dry run (simulate without downloading or extracting):**

```bash
python src/run_assemble.py builds/opensearch/manifest.yml --dry-run
```

**Generate a new manifest file for version 2.14.0:**

```bash
python src/run_assemble.py --generate-manifest output-manifest.yml --version 2.14.0 --platform linux --arch x64 --dist tar --component opensearch
```
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, can be added as examples for assemble.sh.

console.configure(level=args.logging_level)

if args.dry_run:
print("Dry-run enabled. Skipping actual download or extraction.")
Copy link
Member

Choose a reason for hiding this comment

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

We should use logging instead of print.

Copy link
Member

Choose a reason for hiding this comment

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

Similar for all the prints here.

Comment on lines +65 to +69
if args.manifest:
print(f"Manifest file: {args.manifest.name}")
else:
print("No manifest file provided.")
return 0
Copy link
Member

Choose a reason for hiding this comment

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

Did not get, what is the usage of --dry-run here?
I can understand generate_manifest without actual assembling, but for dry_run itself it just print three times?

Comment on lines +32 to +47
manifest_content = {
"build": {
"name": component,
"version": version,
"platform": platform_name,
"architecture": arch,
"distribution": dist
},
"components": [
{
"name": component,
"version": version,
"url": url
}
]
}
Copy link
Member

Choose a reason for hiding this comment

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

Are we not reusing the recorder logic for assemble_workflow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 👀 In Review

Development

Successfully merging this pull request may close these issues.

3 participants