Skip to content

Commit

Permalink
New script to get latest conda artifact from a given repo PR (#85)
Browse files Browse the repository at this point in the history
Co-authored-by: AJ Schmidt <[email protected]>
  • Loading branch information
harrism and ajschmidt8 authored Nov 13, 2023
1 parent b2c5e45 commit f441379
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tools/rapids-get-pr-conda-artifact
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/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) [optional] commit hash, to get the artifact for a specific commit
#
# Example Usage:
# 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=$(gh api "/repos/rapidsai/${repo}/pulls/${pr}" -q '.head.sha[:7]')
fi

rapids-get-artifact "ci/${repo}/pull-request/${pr}/${commit}/${artifact_name}"

0 comments on commit f441379

Please sign in to comment.