Skip to content
Merged
Show file tree
Hide file tree
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 Feb 5, 2025
5b325b4
made changes to download scripts
jayavenkatesh19 Feb 5, 2025
e2aa648
Update release.yaml to generate releases on fork
jayavenkatesh19 Feb 6, 2025
9a86d12
Update release.yaml to run release action
jayavenkatesh19 Feb 6, 2025
c40dbe5
made files executable
jayavenkatesh19 Feb 6, 2025
e2d6ebd
fixed error in download script
jayavenkatesh19 Feb 6, 2025
a745ffb
fixed error in run-id script
jayavenkatesh19 Feb 6, 2025
3006ba4
added wheel download script
jayavenkatesh19 Feb 11, 2025
d115043
Merge branch 'main' into test-github-artifacts
jayavenkatesh19 Feb 11, 2025
f193a1b
Merge remote-tracking branch 'origin/main' into test-github-artifacts
jayavenkatesh19 Feb 19, 2025
16ef8c0
add newlines at the end
jayavenkatesh19 Feb 19, 2025
5cf9875
added support for PR artifact downloads from Github
jayavenkatesh19 Feb 28, 2025
6d5f691
Merge remote-tracking branch 'origin/main' into test-github-artifacts
jayavenkatesh19 Mar 10, 2025
92b5e11
made changes to comments and revert package name to use .tar.gz
jayavenkatesh19 Mar 11, 2025
b9202b1
reverted ci workflow
jayavenkatesh19 Mar 11, 2025
5ee86fc
added newline at the end
jayavenkatesh19 Mar 11, 2025
af2e8df
fixed newline in release.yaml
jayavenkatesh19 Mar 11, 2025
cb79a11
added double-quotes for shellchecker
jayavenkatesh19 Mar 11, 2025
feb6f30
made files executable
jayavenkatesh19 Mar 11, 2025
d1bbfd7
made changes as per code review
jayavenkatesh19 Mar 12, 2025
a2cd7a2
use ghcli to get latest commit
jayavenkatesh19 Mar 12, 2025
9458fc1
made changes as per review comments
jayavenkatesh19 Mar 13, 2025
ac1067a
added flag to remove .tar.gz extension
jayavenkatesh19 Mar 14, 2025
d8056d7
added double quotes to prevent globbing
jayavenkatesh19 Mar 14, 2025
b4b0fbb
Update tools/rapids-get-pr-wheel-artifact-github
jayavenkatesh19 Mar 14, 2025
32eca28
added download string to rapids-logger
jayavenkatesh19 Mar 14, 2025
578ad3c
switched logger back to stderr
jayavenkatesh19 Mar 14, 2025
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
31 changes: 31 additions & 0 deletions tools/rapids-download-conda-from-github
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
Comment thread
jayavenkatesh19 marked this conversation as resolved.
Resolved

source rapids-prompt-local-repo-config

# Prepare empty dir to extract tarball to
# channel="/tmp/${pkg_type}_channel"
Comment thread
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}"
21 changes: 21 additions & 0 deletions tools/rapids-download-from-github
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)"
Comment thread
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}"
Comment thread
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}"
17 changes: 17 additions & 0 deletions tools/rapids-download-wheels-from-github
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")"
Comment thread
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
Comment thread
jayavenkatesh19 marked this conversation as resolved.
Resolved

rapids-download-from-github "${pkg_name}"
46 changes: 46 additions & 0 deletions tools/rapids-get-pr-conda-artifact-github
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)
Comment thread
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)
Comment thread
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}"
Comment thread
jayavenkatesh19 marked this conversation as resolved.
Resolved
)

echo -n "${unzip_dest}"
53 changes: 53 additions & 0 deletions tools/rapids-get-pr-wheel-artifact-github
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
Comment thread
jayavenkatesh19 marked this conversation as resolved.
Resolved
echo "The RAPIDS_PY_WHEEL_NAME variable must be set when fetching a wheel artifact"
Comment thread
jayavenkatesh19 marked this conversation as resolved.
Resolved
exit 1
fi

# Create a temporary directory for the artifact
unzip_dest=$(mktemp -d)
Comment thread
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}"
Comment thread
jayavenkatesh19 marked this conversation as resolved.
Resolved
)

echo -n "${unzip_dest}"
25 changes: 25 additions & 0 deletions tools/rapids-github-run-id
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
Comment thread
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
Comment thread
jayavenkatesh19 marked this conversation as resolved.
Resolved

echo -n "${run_id}"