forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdownload-maven-cache.sh
More file actions
executable file
·33 lines (27 loc) · 916 Bytes
/
download-maven-cache.sh
File metadata and controls
executable file
·33 lines (27 loc) · 916 Bytes
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
#!/usr/bin/env bash
set -e
# This script downloads previous maven packages that have been downloaded
# from Google Cloud Storage to local path for faster build
usage()
{
echo "usage: prepare_maven_cache.sh
--archive-uri gcs uri to retrieve maven .m2 archive
--output-dir output directory for .m2 directory"
}
while [ "$1" != "" ]; do
case "$1" in
--archive-uri ) ARCHIVE_URI="$2"; shift;;
--output-dir ) OUTPUT_DIR="$2"; shift;;
* ) usage; exit 1
esac
shift
done
if [[ ! ${ARCHIVE_URI} ]]; then usage; exit 1; fi
if [[ ! ${OUTPUT_DIR} ]]; then usage; exit 1; fi
# Install Google Cloud SDK if gsutil command not exists
if [[ ! $(command -v gsutil) ]]; then
CURRENT_DIR=$(dirname "$BASH_SOURCE")
. "${CURRENT_DIR}"/install-google-cloud-sdk.sh
fi
gsutil -q cp ${ARCHIVE_URI} /tmp/.m2.tar
tar xf /tmp/.m2.tar -C ${OUTPUT_DIR}