-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
copy_build_artifacts.sh
executable file
·58 lines (49 loc) · 1.66 KB
/
copy_build_artifacts.sh
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
58
#!/bin/bash
set -exuo pipefail
ARTIFACT_TYPE=${1:-wheel}
if [[ "$OSTYPE" == "msys" ]]; then
ARTIFACT_MOUNT="/c/artifact-mount"
else
ARTIFACT_MOUNT="/artifact-mount"
fi
if [[ "$ARTIFACT_TYPE" != "wheel" && "$ARTIFACT_TYPE" != "jar" ]]; then
echo "Invalid artifact type: $ARTIFACT_TYPE"
exit 1
fi
if [[ "$ARTIFACT_TYPE" == "wheel" ]]; then
BRANCH_DESTINATION="branch_wheels"
MASTER_DESTINATION="wheels"
if [[ "$OSTYPE" == "msys" ]]; then
ARTIFACT_PATH="python/dist"
else
ARTIFACT_PATH=".whl"
fi
else
BRANCH_DESTINATION="branch_jars"
MASTER_DESTINATION="jars"
ARTIFACT_PATH=".jar/linux"
fi
if [[ "$OSTYPE" == "msys" ]]; then
ARTIFACT_PATH="python/dist"
ARTIFACT_MOUNT="/c/artifact-mount"
fi
export PATH=/opt/python/cp39-cp39/bin:$PATH
pip install -U --ignore-installed -c python/requirements_compiled.txt \
aws_requests_auth boto3 urllib3 cryptography pyopenssl
./ci/env/env_info.sh
# Sync the directory to buildkite artifacts
ARTIFACT_MOUNT_PATH="$ARTIFACT_MOUNT/$ARTIFACT_PATH"
rm -rf "$ARTIFACT_MOUNT_PATH" || true
mkdir -p "$ARTIFACT_MOUNT_PATH"
cp -r "$ARTIFACT_PATH" "$ARTIFACT_MOUNT_PATH"
chmod -R 777 "$ARTIFACT_MOUNT_PATH"
# Upload to the wheels S3 bucket when running on postmerge pipeline.
readonly PIPELINE_POSTMERGE="0189e759-8c96-4302-b6b5-b4274406bf89"
if [[ "${BUILDKITE_PIPELINE_ID:-}" == "${PIPELINE_POSTMERGE}" ]]; then
# Upload to branch directory.
python .buildkite/copy_files.py --destination "$BRANCH_DESTINATION" --path "./$ARTIFACT_PATH"
# Upload to latest directory.
if [[ "$BUILDKITE_BRANCH" == "master" ]]; then
python .buildkite/copy_files.py --destination "$MASTER_DESTINATION" --path "./$ARTIFACT_PATH"
fi
fi