Skip to content

Commit

Permalink
Add ability to pull a wheel artifact as well as a conda one (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr authored Jan 3, 2025
1 parent 5494167 commit 0558ffc
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 47 deletions.
33 changes: 33 additions & 0 deletions tools/_rapids-get-pr-artifact
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Echo path to an artifact for a specific PR. 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) "wheel" or "conda", to get the wheel or conda package artifact, respectively
# 5) [optional] commit hash, to get the artifact for a specific commit
#
# If fetching a wheel, RAPIDS_PY_WHEEL_NAME must be set to indicate the package
# name to fetch.
# Example Usage:
# _rapids-get-pr-artifact rmm 1095 cpp
set -euo pipefail

repo="${1}"
pr="${2}"
package_type="${3}"
package_format="${4}"
commit="${5:-}"

if [[ "${package_format}" = "wheel" && -z "${RAPIDS_PY_WHEEL_NAME:+placeholder}" ]]; then
echo "The RAPIDS_PY_WHEEL_NAME variable must be set when fetching a wheel artifact"
exit 1
fi
artifact_name=$(RAPIDS_REPOSITORY="${repo}" rapids-package-name "${package_format}_${package_type}")

if [[ -z "${commit}" ]]; then
commit=$(git ls-remote https://github.com/rapidsai/"${repo}".git refs/heads/pull-request/"${pr}" | cut -c1-7)
fi

rapids-get-artifact "ci/${repo}/pull-request/${pr}/${commit}/${artifact_name}"
24 changes: 1 addition & 23 deletions tools/rapids-get-pr-conda-artifact
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,4 @@
# rapids-get-pr-conda-artifact rmm 1095 cpp
set -euo pipefail

repo="$1"
pr="$2"

pkg_type="$3"
case "${pkg_type}" in
cpp)
artifact_name=$(RAPIDS_REPOSITORY=$repo rapids-package-name conda_cpp)
;;
python)
artifact_name=$(RAPIDS_REPOSITORY=$repo rapids-package-name conda_python)
;;
*)
echo "Error: 3rd argument must be 'cpp' or 'python'"
exit 1
;;
esac

commit="${4:-}"
if [[ -z "${commit}" ]]; then
commit=$(git ls-remote https://github.com/rapidsai/"${repo}".git refs/heads/pull-request/"${pr}" | cut -c1-7)
fi

rapids-get-artifact "ci/${repo}/pull-request/${pr}/${commit}/${artifact_name}"
_rapids-get-pr-artifact "${1}" "${2}" "${3}" conda "${4:-}"
27 changes: 3 additions & 24 deletions tools/rapids-get-pr-wheel-artifact
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,9 @@
# 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-conda-artifact rmm 1095 cpp
# rapids-get-pr-wheel-artifact rmm 1095 cpp
set -euo pipefail

repo="$1"
pr="$2"

pkg_type="$3"
case "${pkg_type}" in
cpp)
artifact_name=$(RAPIDS_REPOSITORY=$repo rapids-package-name wheel_cpp)
;;
python)
artifact_name=$(RAPIDS_REPOSITORY=$repo rapids-package-name wheel_python)
;;
*)
echo "Error: 3rd argument must be 'cpp' or 'python'"
exit 1
;;
esac

commit="${4:-}"
if [[ -z "${commit}" ]]; then
commit=$(git ls-remote https://github.com/rapidsai/"${repo}".git refs/heads/pull-request/"${pr}" | cut -c1-7)
fi

rapids-get-artifact "ci/${repo}/pull-request/${pr}/${commit}/${artifact_name}"
_rapids-get-pr-artifact "${1}" "${2}" "${3}" wheel "${4:-}"

0 comments on commit 0558ffc

Please sign in to comment.