-
Notifications
You must be signed in to change notification settings - Fork 264
Optional S3 artifacts features #3663
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
Changes from 1 commit
2d5bd64
d1d858d
440cb88
9e50dda
0fceb67
9c69a35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script is only used by "CI", not "Multi-arch CI", and thus is scheduled for deletion (#3340). New feature work should be in https://github.com/ROCm/TheRock/blob/main/build_tools/github_actions/post_stage_upload.py
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless NPI pipelines are changed to work with multi-arch CI, such scripts that the older CI used cannot be deleted. A discussion on how multi-arch CI can intersect NPI pipelines is overdue. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,20 @@ | |
| [--build-dir BUILD_DIR] | ||
| [--upload | --no-upload] (default enabled if the `CI` env var is set) | ||
| [--run-id RUN_ID] | ||
| [--s3-subdir-artifacts PREFIX] [--s3-summary-base-url URL] [--s3-summary-path PREFIX] | ||
| [--skip-manifest] | ||
|
|
||
| S3 path/URL arguments (--s3-subdir-artifacts, --s3-summary-base-url, --s3-summary-path): | ||
| Must not end with a forward slash. The script joins segments with "/". | ||
| --s3-subdir-artifacts is the path prefix in the S3 bucket; --s3-summary-path is | ||
| the corresponding path as it appears in the CloudFront (summary) URL. This | ||
| optional path aligns with the prerelease CloudFront layout used for tarballs | ||
| and wheels. | ||
|
|
||
| Example (CloudFront base URL for job summary links): | ||
| --s3-subdir-artifacts v3/artifacts | ||
| --s3-summary-base-url https://rocm.foobar.amd.com | ||
| --s3-summary-path artifacts | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we should be mentioning CloudFront at all in most of our code. It's a CDN, an implementation detail. What matters is the URL, which could be backed by any CDN or other webserver and this code would not change.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed mentions of CloudFront to support any CDN. |
||
|
|
||
| This script runs after building TheRock, where this script does: | ||
| 1. Create log archives | ||
|
|
@@ -309,10 +323,23 @@ def run(args): | |
|
|
||
| external_repo_path, bucket = retrieve_bucket_info() | ||
| run_id = args.run_id | ||
| bucket_uri = f"s3://{bucket}/{external_repo_path}{run_id}-{PLATFORM}" | ||
| bucket_url = ( | ||
| f"https://{bucket}.s3.amazonaws.com/{external_repo_path}{run_id}-{PLATFORM}" | ||
| path_suffix = ( | ||
| f"{args.s3_subdir_artifacts}/{external_repo_path}{run_id}-{PLATFORM}" | ||
| if args.s3_subdir_artifacts | ||
| else f"{external_repo_path}{run_id}-{PLATFORM}" | ||
| ) | ||
| bucket_uri = f"s3://{bucket}/{path_suffix}" | ||
|
|
||
| if args.s3_summary_base_url: | ||
| run_suffix = f"{external_repo_path}{run_id}-{PLATFORM}" | ||
| summary_path = ( | ||
| f"{args.s3_summary_path}/{run_suffix}" | ||
| if args.s3_summary_path | ||
| else path_suffix | ||
| ) | ||
| bucket_url = f"{args.s3_summary_base_url}/{summary_path}" | ||
| else: | ||
| bucket_url = f"https://{bucket}.s3.amazonaws.com/{path_suffix}" | ||
|
|
||
| log("Write Windows time sync log") | ||
| log("----------------------") | ||
|
|
@@ -328,9 +355,10 @@ def run(args): | |
| log("----------") | ||
| upload_logs_to_s3(args.artifact_group, args.build_dir, bucket_uri) | ||
|
|
||
| log("Upload manifest") | ||
| log("----------------") | ||
| upload_manifest_to_s3(args.artifact_group, args.build_dir, bucket_uri) | ||
| if not args.skip_manifest: | ||
| log("Upload manifest") | ||
| log("----------------") | ||
| upload_manifest_to_s3(args.artifact_group, args.build_dir, bucket_uri) | ||
|
|
||
| log("Write github actions build summary") | ||
| log("--------------------") | ||
|
|
@@ -363,6 +391,30 @@ def run(args): | |
| parser.add_argument( | ||
| "--job-status", type=str, help="Status of this Job ('success', 'failure')" | ||
| ) | ||
| parser.add_argument( | ||
| "--s3-subdir-artifacts", | ||
| type=str, | ||
| default="", | ||
| help="S3 path prefix for artifacts (e.g. v3/artifacts). Must not end with /.", | ||
| ) | ||
| parser.add_argument( | ||
| "--s3-summary-base-url", | ||
| type=str, | ||
| default="", | ||
| help="Base URL for job summary links (e.g. CloudFront). Must not end with /. If set, summary uses this instead of raw S3 URL.", | ||
| ) | ||
| parser.add_argument( | ||
| "--s3-summary-path", | ||
| type=str, | ||
| default="", | ||
| help="Path prefix for summary URL when --s3-summary-base-url is set (e.g. artifacts). Must not end with /.", | ||
| ) | ||
|
Comment on lines
+358
to
+363
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either strip trailing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Trailing |
||
| parser.add_argument( | ||
| "--skip-manifest", | ||
| action=argparse.BooleanOptionalAction, | ||
| default=False, | ||
| help="Skip manifest upload.", | ||
| ) | ||
| args = parser.parse_args() | ||
|
|
||
| # Check preconditions for provided arguments before proceeding. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An override seems useful, but we need to be careful here. Environment variables are global, affecting all processes. Some of our workflows need the ability to read artifacts from one S3 bucket and write to another S3 bucket. We can do things like only set the environment variable for certain workflow steps, but at that point I think directly passing some setting through to the top level scripts and then into this function (or where I'm moving it to in #3596) would be safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced the usage of an env with an explicit
--artifacts-bucketarg that gets passed directly intoWorkflowOutputRoot.from_workflow_run()as abucket_overrideparameter.