-
Notifications
You must be signed in to change notification settings - Fork 16
/
rapids-s3-path
executable file
·57 lines (49 loc) · 1.56 KB
/
rapids-s3-path
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# A utility script that examines environment variables provided
# by GitHub Actions to print out an S3 path where the expected artifact
# should be.
#
# The output format should be one of the following:
#
## For PR builds:
## s3://rapids-downloads/ci/<REPO_NAME>/pull-request/<PR_NUMBER>/<SHORT_HASH>/
## For branch builds:
## s3://rapids-downloads/ci/<REPO_NAME>/branch/<BRANCH_NAME>/<SHORT_HASH>/
## For nightly builds:
## s3://rapids-downloads/nightly/<REPO_NAME>/<DATE>/<SHORT_HASH>/
set -euo pipefail
source rapids-constants
export RAPIDS_SCRIPT_NAME="rapids-s3-path"
repo_name="${RAPIDS_REPOSITORY##*/}"
s3_directory_id=""
s3_prefix=""
case "${RAPIDS_BUILD_TYPE}" in
pull-request)
# For PRs, we are using the 'trusted jobs on untrusted forks' paradigm
# by copying PRs to branches named pull-request/$prnum
# more info:
# CopyPRs plugin in ops-bot: https://github.com/rapidsai/ops-bot#plugins
# https://circleci.com/blog/triggering-trusted-ci-jobs-on-untrusted-forks/
s3_directory_id="${RAPIDS_REF_NAME##*/}"
s3_prefix="ci"
;;
branch)
s3_directory_id="${RAPIDS_REF_NAME}"
s3_prefix="ci"
;;
nightly)
s3_directory_id="${RAPIDS_NIGHTLY_DATE}"
s3_prefix="nightly"
;;
*)
rapids-echo-stderr "please pass a valid RAPIDS_BUILD_TYPE"
exit 1
;;
esac
short_hash=${RAPIDS_SHA:0:7}
s3_path="s3://${RAPIDS_DOWNLOADS_BUCKET}/${s3_prefix}/${repo_name}/"
if [[ "${RAPIDS_BUILD_TYPE}" != "nightly" ]]; then
s3_path+="${RAPIDS_BUILD_TYPE}/"
fi
s3_path+="${s3_directory_id}/${short_hash}/"
echo -n "${s3_path}"