Skip to content

Instantly share code, notes, and snippets.

@kensipe
Created July 20, 2017 14:38
Show Gist options
  • Save kensipe/33af0dac168c4bed34429fe231e05472 to your computer and use it in GitHub Desktop.
Save kensipe/33af0dac168c4bed34429fe231e05472 to your computer and use it in GitHub Desktop.
#!/bin/bash
# expect git and aws with prod creds
# expects to be in the marathon dir or have the MARATHON_PROJECT_DIR set
if [ -z "$MARATHON_PROJECT_DIR" ]; then
echo "MARATHON_PROJECT_DIR NOT set... using current directory"
else
pushd $MARATHON_PROJECT_DIR
fi
if [ $# -eq 0 ]
then
set -e
GITSHA=$(git rev-parse HEAD)
echo "Current SHA: $SHA"
else
GITSHA="$1"
fi
SHORT_SHA=${GITSHA:0:7}
echo "SHORT: $SHORT_SHA"
FILES=$(aws s3 ls s3://downloads.mesosphere.io/marathon/snapshots/ | grep $SHORT_SHA.tgz | awk '{print $4}')
for FILE in $FILES; do
FILE_URL="https://s3.amazonaws.com/downloads.mesosphere.io/marathon/snapshots/$FILE"
if [[ ${FILE: -5} == .sha1 ]]
then
echo $(curl -s "$FILE_URL")
else
echo $FILE_URL
fi
done
if [ -n "$MARATHON_PROJECT_DIR" ]; then
popd
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment