-
Notifications
You must be signed in to change notification settings - Fork 245
[ci] Reorganizing artifact upload #730
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
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
267a2b5
Moving S3 upload to script
geomin12 10b3179
Fixing multi line
geomin12 5bd689a
fixing args
geomin12 db2cfbc
removing space
geomin12 71ae144
Adding correct logs
geomin12 8e0d6b0
Adding external folder opp
geomin12 e0fc665
removing quotes
geomin12 a938a3f
Adding external repo portion
geomin12 9a2a5a6
merge conflict
geomin12 7303b19
Fixing URL
geomin12 2602d55
Fixing the logging
geomin12 332b190
attempting temp sha
geomin12 f131a5f
try with develop
geomin12 7ca5b15
Adding cmake updates
geomin12 231a9a5
changing sha
geomin12 842d5b0
Merge branch 'main' of https://github.com/ROCm/TheRock into users/geo…
geomin12 9d5c24e
changing ref
geomin12 669aa3c
Adding temp sha for prim
geomin12 5376ae4
Adding log statement
geomin12 b1359b3
PR comments
geomin12 3a6e66d
more PR comments
geomin12 cfec363
Fixing shlex type
geomin12 353f95f
Pr comments
geomin12 a5c71e8
Adding sys path
geomin12 de726c6
Adding str for path
geomin12 2fd83e8
Adding correct args
geomin12 97c4ed0
Reorganizing
geomin12 c0ac9cf
PR comments
geomin12 74b3bc5
Removing ref
geomin12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -199,52 +199,36 @@ jobs: | |
| aws-region: us-east-2 | ||
| role-to-assume: arn:aws:iam::692859939525:role/therock-artifacts | ||
|
|
||
| # TODO: Move to script | ||
| - name: Create Index Files | ||
| - name: Create Logs index Files | ||
| if: always() | ||
| run: | | ||
| curl --silent --fail --show-error --location \ | ||
| https://raw.githubusercontent.com/joshbrunty/Indexer/6d8cbfd15d3853b482e6a49f2d875ded9188b721/indexer.py \ | ||
| --output ${{ env.BUILD_DIR_BASH }}/indexer.py | ||
| python ${{ env.BUILD_DIR_BASH }}/indexer.py -f '*.tar.xz*' ${{ env.BUILD_DIR_BASH }}/artifacts/ | ||
| python build_tools/create_log_index.py \ | ||
| python3 build_tools/github_actions/create_log_index.py \ | ||
| --build-dir=${{ env.BUILD_DIR_BASH }} \ | ||
| --amdgpu-family=${{ env.AMDGPU_FAMILIES }} | ||
|
|
||
| # TODO: Move to script | ||
| - name: Upload Artifacts | ||
| shell: powershell | ||
| - name: Upload artifacts | ||
| if: always() | ||
| run: | | ||
| $Env:PATH += ";C:\Program Files\Amazon\AWSCLIV2" | ||
| aws s3 cp ${{ env.BASE_BUILD_DIR_POWERSHELL }}\artifacts s3://therock-artifacts/${{github.run_id}}-windows/ ` | ||
| --recursive --no-follow-symlinks ` | ||
| --exclude "*" ` | ||
| --include "*.tar.xz*" | ||
| aws s3 cp ${{ env.BASE_BUILD_DIR_POWERSHELL }}\artifacts\index.html s3://therock-artifacts/${{github.run_id}}-windows/index-${{env.AMDGPU_FAMILIES}}.html | ||
| python build_tools/github_actions/upload_build_artifacts.py \ | ||
| --run-id ${{ github.run_id }} \ | ||
| --amdgpu-family ${{ env.AMDGPU_FAMILIES }} \ | ||
| --build-dir ${{ env.BUILD_DIR_BASH }} | ||
|
|
||
| - name: Upload Logs | ||
| if: always() | ||
| shell: powershell | ||
| run: | | ||
| $Env:PATH += ";C:\Program Files\Amazon\AWSCLIV2" | ||
| python3 build_tools/upload_logs_to_s3.py ` | ||
| --build-dir=${{ env.BASE_BUILD_DIR_POWERSHELL }} ` | ||
|
Comment on lines
-227
to
-231
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. Looks like |
||
| --s3-base-path="s3://therock-artifacts/${{github.run_id}}-windows/logs/${{env.AMDGPU_FAMILIES}}" | ||
| python3 build_tools/github_actions/upload_build_logs_to_s3.py \ | ||
| --build-dir=${{ env.BUILD_DIR_BASH }} \ | ||
| --run-id ${{ github.run_id }} \ | ||
| --amdgpu-family ${{ env.AMDGPU_FAMILIES }} | ||
|
|
||
| - name: Add Links to Job Summary | ||
| if: always() | ||
| run: | | ||
| LOG_URL="https://therock-artifacts.s3.us-east-2.amazonaws.com/${{github.run_id}}-windows/logs/${{env.AMDGPU_FAMILIES}}/index.html" | ||
| echo "[Build Logs](${LOG_URL})" >> $GITHUB_STEP_SUMMARY | ||
|
|
||
| ARTIFACT_INDEX="${{ env.BASE_BUILD_DIR_POWERSHELL }}/artifacts/index.html" | ||
| if [ -f "${ARTIFACT_INDEX}" ]; then | ||
| ARTIFACT_URL="https://therock-artifacts.s3.us-east-2.amazonaws.com/${{github.run_id}}-windows/index-${{env.AMDGPU_FAMILIES}}.html" | ||
|
|
||
| echo "[Artifacts](${ARTIFACT_URL})" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "[INFO] No artifacts index found. Skipping artifact link." | ||
| fi | ||
| python build_tools/github_actions/upload_build_summary.py \ | ||
| --run-id ${{ github.run_id }} \ | ||
| --amdgpu-family ${{ env.AMDGPU_FAMILIES }} \ | ||
| --build-dir ${{ env.BUILD_DIR_BASH }} | ||
|
|
||
| - name: Save cache | ||
| uses: actions/cache/save@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| #!/usr/bin/env python3 | ||
| """ | ||
| upload_build_artifacts.py | ||
|
|
||
| Uploads build artifacts to AWS S3 bucket | ||
| """ | ||
|
|
||
| import argparse | ||
| import logging | ||
| import os | ||
| from pathlib import Path | ||
| import platform | ||
| import shlex | ||
| import subprocess | ||
| import sys | ||
|
|
||
| logging.basicConfig(level=logging.INFO) | ||
|
|
||
| THEROCK_DIR = Path(__file__).resolve().parent.parent.parent | ||
| PLATFORM = platform.system().lower() | ||
|
|
||
| # Importing indexer.py | ||
| sys.path.append(str(THEROCK_DIR / "third-party" / "indexer")) | ||
| from indexer import process_dir | ||
|
|
||
|
|
||
| def exec(cmd: list[str], cwd: Path): | ||
| logging.info(f"++ Exec [{cwd}]$ {shlex.join(cmd)}") | ||
| subprocess.run(cmd, check=True) | ||
|
|
||
|
|
||
| def retrieve_bucket_info() -> tuple[str, str]: | ||
| github_repository = os.getenv("GITHUB_REPOSITORY", "ROCm/TheRock") | ||
| owner, repo_name = github_repository.split("/") | ||
| external_repo = ( | ||
| "" if repo_name == "TheRock" and owner == "ROCm" else f"{owner}-{repo_name}/" | ||
| ) | ||
| bucket = ( | ||
| "therock-artifacts" | ||
| if repo_name == "TheRock" and owner == "ROCm" | ||
| else "therock-artifacts-external" | ||
| ) | ||
| return (external_repo, bucket) | ||
|
|
||
|
|
||
| def create_index_file(args: argparse.Namespace): | ||
| logging.info("Creating index file") | ||
| build_dir = args.build_dir / "artifacts" | ||
|
|
||
| indexer_args = argparse.Namespace() | ||
| indexer_args.filter = "*.tar.xz*" | ||
| indexer_args.output_file = "index.html" | ||
| indexer_args.verbose = False | ||
| indexer_args.recursive = False | ||
| process_dir(build_dir, indexer_args) | ||
|
|
||
|
|
||
| def upload_artifacts(args: argparse.Namespace, bucket_uri: str): | ||
| logging.info("Uploading artifacts to S3") | ||
| build_dir = args.build_dir | ||
| amdgpu_family = args.amdgpu_family | ||
|
|
||
| # Uploading artifacts to S3 bucket | ||
| cmd = [ | ||
| "aws", | ||
| "s3", | ||
| "cp", | ||
| str(build_dir / "artifacts"), | ||
| bucket_uri, | ||
| "--recursive", | ||
| "--no-follow-symlinks", | ||
| "--exclude", | ||
| "*", | ||
| "--include", | ||
| "*.tar.xz*", | ||
| ] | ||
| exec(cmd, cwd=Path.cwd()) | ||
|
|
||
| # Uploading index.html to S3 bucket | ||
| cmd = [ | ||
| "aws", | ||
| "s3", | ||
| "cp", | ||
| str(build_dir / "artifacts" / "index.html"), | ||
| f"{bucket_uri}/index-{amdgpu_family}.html", | ||
| ] | ||
| exec(cmd, cwd=Path.cwd()) | ||
|
|
||
|
|
||
| def run(args: argparse.Namespace): | ||
| external_repo_path, bucket = retrieve_bucket_info() | ||
| run_id = args.run_id | ||
| bucket_uri = f"s3://{bucket}/{external_repo_path}{run_id}-{PLATFORM}" | ||
|
|
||
| create_index_file(args) | ||
| upload_artifacts(args, bucket_uri) | ||
|
|
||
|
|
||
| def main(argv): | ||
| parser = argparse.ArgumentParser(prog="artifact_upload") | ||
| parser.add_argument( | ||
| "--run-id", type=str, required=True, help="GitHub run ID of this workflow run" | ||
| ) | ||
|
|
||
| parser.add_argument( | ||
| "--amdgpu-family", type=str, required=True, help="AMD GPU family to upload" | ||
| ) | ||
|
|
||
| parser.add_argument( | ||
| "--build-dir", | ||
| type=Path, | ||
| required=True, | ||
| help="Path to the build directory of TheRock", | ||
| ) | ||
|
|
||
| args = parser.parse_args(argv) | ||
| run(args) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main(sys.argv[1:]) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.