Repository navigation
Adding scripts to download and upload artifacts to the Github Artifact Store #152
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
ajschmidt8
merged 27 commits into
rapidsai:main
from
jayavenkatesh19:test-github-artifacts
Mar 14, 2025
Merged
Changes from 19 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
b6fb6b1
added tools for Github artifact download
jayavenkatesh19 5b325b4
made changes to download scripts
jayavenkatesh19 e2aa648
Update release.yaml to generate releases on fork
jayavenkatesh19 9a86d12
Update release.yaml to run release action
jayavenkatesh19 c40dbe5
made files executable
jayavenkatesh19 e2d6ebd
fixed error in download script
jayavenkatesh19 a745ffb
fixed error in run-id script
jayavenkatesh19 3006ba4
added wheel download script
jayavenkatesh19 d115043
Merge branch 'main' into test-github-artifacts
jayavenkatesh19 f193a1b
Merge remote-tracking branch 'origin/main' into test-github-artifacts
jayavenkatesh19 16ef8c0
add newlines at the end
jayavenkatesh19 5cf9875
added support for PR artifact downloads from Github
jayavenkatesh19 6d5f691
Merge remote-tracking branch 'origin/main' into test-github-artifacts
jayavenkatesh19 92b5e11
made changes to comments and revert package name to use .tar.gz
jayavenkatesh19 b9202b1
reverted ci workflow
jayavenkatesh19 5ee86fc
added newline at the end
jayavenkatesh19 af2e8df
fixed newline in release.yaml
jayavenkatesh19 cb79a11
added double-quotes for shellchecker
jayavenkatesh19 feb6f30
made files executable
jayavenkatesh19 d1bbfd7
made changes as per code review
jayavenkatesh19 a2cd7a2
use ghcli to get latest commit
jayavenkatesh19 9458fc1
made changes as per review comments
jayavenkatesh19 ac1067a
added flag to remove .tar.gz extension
jayavenkatesh19 d8056d7
added double quotes to prevent globbing
jayavenkatesh19 b4b0fbb
Update tools/rapids-get-pr-wheel-artifact-github
jayavenkatesh19 32eca28
added download string to rapids-logger
jayavenkatesh19 578ad3c
switched logger back to stderr
jayavenkatesh19 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| #!/bin/bash | ||
| # A utility script that downloads a conda artifact archive from Github Artifacts, unzips it, | ||
| # and returns the path to the directory where it was unzipped. | ||
| # Positional Arguments: | ||
| # 1) a string of "cpp" or "python" which determines which conda artifact | ||
| # should be downloaded | ||
| set -euo pipefail | ||
| export RAPIDS_SCRIPT_NAME="rapids-download-conda-from-github" | ||
|
|
||
| pkg_type="$1" | ||
| case "${pkg_type}" in | ||
| cpp) | ||
| ;& | ||
| python) | ||
| ;; | ||
| *) | ||
| rapids-echo-stderr 'Pass "cpp" or "python" as an argument.' | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
|
||
| source rapids-prompt-local-repo-config | ||
|
|
||
| # Prepare empty dir to extract tarball to | ||
| # channel="/tmp/${pkg_type}_channel" | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
|
|
||
| # Prepend `conda_` to PKG_TYPE for rapids-package-name function | ||
| pkg_type="conda_${pkg_type}" | ||
| pkg_name="$(rapids-package-name "$pkg_type")" | ||
|
|
||
| rapids-download-from-github "${pkg_name}" | ||
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,21 @@ | ||
| #!/bin/bash | ||
| # A utility script that downloads an artifact from Github Artifacts, unzips it to a temporary directory, | ||
| # and prints the location where it was unzipped. | ||
| # Positional Arguments: | ||
| # 1) package name to generate s3 path for | ||
| set -euo pipefail | ||
| export RAPIDS_SCRIPT_NAME="rapids-download-from-github" | ||
|
|
||
| if [ -z "$1" ]; then | ||
| rapids-echo-stderr "Must specify input arguments: PKG_NAME" | ||
| exit 1 | ||
| fi | ||
|
|
||
| github_run_id="$(rapids-github-run-id)" | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
| pkg_name="$1" | ||
| unzip_dest="$(mktemp -d)" | ||
|
|
||
| rapids-echo-stderr "Downloading and decompressing ${pkg_name} from Run ID ${github_run_id} into ${unzip_dest}" | ||
|
gforsyth marked this conversation as resolved.
Resolved
|
||
| gh run download "${github_run_id}" --repo "${RAPIDS_REPOSITORY}" --name "${pkg_name}" --dir "${unzip_dest}" | ||
|
|
||
| echo -n "${unzip_dest}" | ||
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,17 @@ | ||
| #!/bin/bash | ||
| # A utility script that downloads wheel artifacts from Github Artifacts to a temporary directory and returns the path to the directory | ||
| set -eo pipefail | ||
|
|
||
| source rapids-prompt-local-repo-config | ||
|
|
||
| # For legacy reasons, allow this script to be run without the pkg_type being the first arg | ||
| pkg_name="$(rapids-package-name "wheel_python")" | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
|
|
||
| pkg_type="$1" | ||
| if [ "${pkg_type}" = "cpp" ] || [ "${pkg_type}" = "python" ]; then | ||
| # remove pkg_type from args because we handle it in this script | ||
| shift; | ||
| pkg_name="$(rapids-package-name "wheel_${pkg_type}")" | ||
| fi | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
|
|
||
| rapids-download-from-github "${pkg_name}" | ||
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,46 @@ | ||
| #!/bin/bash | ||
| # Echo path to an artifact for a specific PR from GitHub Artifacts. | ||
| # Finds and uses the latest commit on the PR. | ||
| # | ||
| # Positional Arguments: | ||
| # 1) repo name | ||
| # 2) PR number | ||
| # 3) "cpp" or "python", to get the artifact for the C++ or Python build, respectively | ||
| # 4) [optional] commit hash, to get the artifact for a specific commit | ||
| # | ||
| # Example Usage: | ||
| # rapids-get-pr-conda-artifact-github rmm 1095 cpp | ||
| set -euo pipefail | ||
|
|
||
| repo="${1}" | ||
| pr="${2}" | ||
| package_type="${3}" | ||
| commit="${4:-}" | ||
|
|
||
| # Create a temporary directory for the artifact | ||
| unzip_dest=$(mktemp -d) | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
|
|
||
| # If commit is not provided, get the latest commit on the PR | ||
| if [[ -z "${commit}" ]]; then | ||
| commit=$(git ls-remote https://github.com/rapidsai/"${repo}".git refs/heads/pull-request/"${pr}" | cut -c1-7) | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
| fi | ||
|
|
||
| # Use a subshell to isolate environment variable changes | ||
| ( | ||
| # Set up environment variables needed for GitHub artifact download | ||
| export RAPIDS_REPOSITORY="rapidsai/${repo}" | ||
| export RAPIDS_BUILD_TYPE="pull-request" | ||
| export RAPIDS_SHA="${commit}" | ||
| export RAPIDS_REF_NAME="pull-request/${pr}" | ||
|
|
||
| # Generate the artifact name | ||
| artifact_name=$(rapids-package-name "conda_${package_type}") | ||
|
|
||
| # Get the GitHub run ID for the PR | ||
| github_run_id=$(rapids-github-run-id) | ||
|
|
||
| rapids-echo-stderr "Downloading and decompressing ${artifact_name} from GitHub Run ID ${github_run_id} into ${unzip_dest}" | ||
| gh run download "${github_run_id}" --repo "${RAPIDS_REPOSITORY}" --name "${artifact_name}" --dir "${unzip_dest}" | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
| ) | ||
|
|
||
| echo -n "${unzip_dest}" | ||
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,53 @@ | ||
| #!/bin/bash | ||
| # Echo path to an artifact for a specific PR from GitHub Artifacts. | ||
| # Finds and uses the latest commit on the PR. | ||
| # | ||
| # Positional Arguments: | ||
| # 1) repo name | ||
| # 2) PR number | ||
| # 3) "cpp" or "python", to get the artifact for the C++ or Python build, respectively | ||
| # 4) [optional] commit hash, to get the artifact for a specific commit | ||
| # | ||
| # RAPIDS_PY_WHEEL_NAME must be set to indicate the package name to fetch. | ||
| # Example Usage: | ||
| # rapids-get-pr-wheel-artifact-github rmm 1095 cpp | ||
| set -euo pipefail | ||
|
|
||
| repo="${1}" | ||
| pr="${2}" | ||
| package_type="${3}" | ||
| commit="${4:-}" | ||
|
|
||
| # Check if RAPIDS_PY_WHEEL_NAME is set when fetching a wheel | ||
| if [[ -z "${RAPIDS_PY_WHEEL_NAME:+placeholder}" ]]; then | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
| echo "The RAPIDS_PY_WHEEL_NAME variable must be set when fetching a wheel artifact" | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
| exit 1 | ||
| fi | ||
|
|
||
| # Create a temporary directory for the artifact | ||
| unzip_dest=$(mktemp -d) | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
|
|
||
| # If commit is not provided, get the latest commit on the PR | ||
| if [[ -z "${commit}" ]]; then | ||
| commit=$(git ls-remote https://github.com/rapidsai/"${repo}".git refs/heads/pull-request/"${pr}" | cut -c1-7) | ||
| fi | ||
|
|
||
| # Use a subshell to isolate environment variable changes | ||
| ( | ||
| # Set up environment variables needed for GitHub artifact download | ||
| export RAPIDS_REPOSITORY="rapidsai/${repo}" | ||
| export RAPIDS_BUILD_TYPE="pull-request" | ||
| export RAPIDS_SHA="${commit}" | ||
| export RAPIDS_REF_NAME="pull-request/${pr}" | ||
|
|
||
| # Generate the artifact name | ||
| artifact_name=$(rapids-package-name "wheel_${package_type}") | ||
|
|
||
| # Get the GitHub run ID for the PR | ||
| github_run_id=$(rapids-github-run-id) | ||
|
|
||
| rapids-echo-stderr "Downloading and decompressing ${artifact_name} from GitHub Run ID ${github_run_id} into ${unzip_dest}" | ||
| gh run download "${github_run_id}" --repo "${RAPIDS_REPOSITORY}" --name "${artifact_name}" --dir "${unzip_dest}" | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
| ) | ||
|
|
||
| echo -n "${unzip_dest}" | ||
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,25 @@ | ||
| #!/bin/bash | ||
| # A utility script that examines environment variables provided | ||
| # by GitHub Actions to print out a Github Workflow Run ID where the expected artifact | ||
| # should be. | ||
| set -euo pipefail | ||
| source rapids-constants | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
| export RAPIDS_SCRIPT_NAME="rapids-github-run-id" | ||
|
|
||
| case "${RAPIDS_BUILD_TYPE}" in | ||
| pull-request) | ||
| run_id=$(gh run list --repo "${RAPIDS_REPOSITORY}" --branch "${RAPIDS_REF_NAME}" --commit "${RAPIDS_SHA}" --json databaseId --jq '.[0] | .databaseId') | ||
| ;; | ||
| branch) | ||
| run_id=$(gh run list --repo "${RAPIDS_REPOSITORY}" --branch "${RAPIDS_REF_NAME}" --commit "${RAPIDS_SHA}" --json databaseId --jq '.[0] | .databaseId') | ||
| ;; | ||
| nightly) | ||
| run_id=$(gh run list --repo "${RAPIDS_REPOSITORY}" --branch "${RAPIDS_REF_NAME}" --commit "${RAPIDS_SHA}" --json databaseId --jq '.[0] | .databaseId') | ||
| ;; | ||
| *) | ||
| rapids-echo-stderr "please pass a valid RAPIDS_BUILD_TYPE" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
|
jayavenkatesh19 marked this conversation as resolved.
Resolved
|
||
|
|
||
| echo -n "${run_id}" | ||
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.