Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 984b311

Browse files
committed
Add verbose flag, use absolute paths
1 parent d4658db commit 984b311

File tree

2 files changed

+39
-16
lines changed

2 files changed

+39
-16
lines changed

_scripts/deploy.sh

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/bin/bash
22

3+
# deploy.sh: Create and deploy distribution artifacts
4+
35
set -e
46

5-
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
6-
bash ${DIR}/make-dist.sh
7-
mkdocs build
8-
exit
97
SITE_BUCKET=s3://docs.opendata.aws/genomics-workflows
108
ASSET_BUCKET=s3://aws-genomics-workflows
119
ASSET_STAGE=test
1210
ASSET_PROFILE=asset-publisher
1311
DEPLOY_REGION=us-east-1
1412

13+
VERBOSE=''
1514
PARAMS=""
1615
while (( "$#" )); do
1716
case "$1" in
@@ -31,6 +30,10 @@ while (( "$#" )); do
3130
DEPLOY_REGION=$2
3231
shift 2
3332
;;
33+
--verbose)
34+
VERBOSE='--verbose'
35+
shift
36+
;;
3437
--) # end optional argument parsing
3538
shift
3639
break
@@ -49,6 +52,9 @@ eval set -- "$PARAMS"
4952

5053
ASSET_STAGE=${1:-$ASSET_STAGE}
5154

55+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
56+
bash ${DIR}/make-dist.sh $VERBOSE
57+
5258
function s3_uri() {
5359
BUCKET=$1
5460
shift
@@ -68,20 +74,23 @@ function s3_sync() {
6874
echo "syncing ..."
6975
echo " from: $source"
7076
echo " to: $destination"
71-
aws s3 sync \
77+
cmd="aws s3 sync \
7278
--profile $ASSET_PROFILE \
7379
--region $DEPLOY_REGION \
74-
--acl public-read \
7580
--delete \
7681
--metadata commit=$(git rev-parse HEAD) \
7782
$source \
78-
$destination
83+
$destination"
84+
echo $cmd
85+
eval $cmd
86+
exit
7987
}
8088

8189
function publish() {
8290
local source=$1
8391
local destination=$2
8492

93+
echo "publish(source: $source, destintation: $destination)"
8594
if [[ $USE_RELEASE_TAG && ! -z "$TRAVIS_TAG" ]]; then
8695
# create explicit pinned versions "latest" and TRAVIS_TAG
8796
# pin the TRAVIS_TAG first, since the files are modified inplace
@@ -149,6 +158,13 @@ function templates() {
149158

150159

151160
function site() {
161+
echo "building site"
162+
if [[ ! `command -v mkdocs` ]]; then
163+
echo "requirement mkdocs not found. aborting"
164+
exit 1
165+
fi
166+
mkdocs build
167+
152168
echo "publishing site"
153169
aws s3 sync \
154170
--region $DEPLOY_REGION \
@@ -166,6 +182,13 @@ function all() {
166182
site
167183
}
168184

185+
# Add 's3://' when missing from bucket names
186+
for bucketname in ASSET_BUCKET SITE_BUCKET; do
187+
if [[ ! $(echo ${!bucketname} | grep 's3://') ]]; then
188+
newname="s3://${!bucketname}";
189+
eval $bucketname=\$newname;
190+
fi
191+
done
169192

170193
echo "DEPLOYMENT STAGE: $ASSET_STAGE"
171194
case $ASSET_STAGE in

_scripts/make-dist.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ set -e
6060

6161
CWD=`pwd`
6262
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
63-
INSTALL_DIR=`dirname $DIR`
63+
INSTALL_DIR=$(dirname $DIR)
6464
SOURCE_PATH=$INSTALL_DIR/src
6565
DIST_PATH=$INSTALL_DIR/dist
6666

@@ -97,20 +97,20 @@ curl --silent -L \
9797
"https://github.com/awslabs/amazon-ebs-autoscale/archive/${EBS_AUTOSCALE_VERSION}.tar.gz" \
9898
-o ./amazon-ebs-autoscale.tar.gz
9999

100-
echo "copying `tar -tzf ./amazon-ebs-autoscale.tar.gz | wc -l` files from ebs-autoscale $EBS_AUTOSCALE_VERSION into tmp/amazon-ebs-autoscale/"
100+
echo "copying $(tar -tzf ./amazon-ebs-autoscale.tar.gz | wc -l) files from ebs-autoscale $EBS_AUTOSCALE_VERSION into tmp/amazon-ebs-autoscale/"
101101
tar $VERBOSE -xzf ./amazon-ebs-autoscale.tar.gz
102102
mv ./amazon-ebs-autoscale*/ ./amazon-ebs-autoscale
103103
echo $EBS_AUTOSCALE_VERSION > ./amazon-ebs-autoscale/VERSION
104104

105-
echo "copying src/ebs-autoscale with `find $SOURCE_PATH/ebs-autoscale/ -type f | wc -l` files to tmp/"
105+
echo "copying src/ebs-autoscale with $(find $SOURCE_PATH/ebs-autoscale/ -type f | wc -l) files to tmp/"
106106
cp $VERBOSE -Rf $SOURCE_PATH/ebs-autoscale .
107-
echo "copying `find amazon-ebs-autoscale -type f | wc -l` files from tmp/amazon-ebs-autoscale/ to tmp/ebs-autoscale/"
107+
echo "copying $(find amazon-ebs-autoscale -type f | wc -l) files from tmp/amazon-ebs-autoscale/ to tmp/ebs-autoscale/"
108108
cp $VERBOSE -Rf ./amazon-ebs-autoscale/* ./ebs-autoscale/
109-
echo "creating artifacts/aws-ebs-autoscale.tgz with `find ./ebs-autoscale/ -type f | wc -l` files from tmp/ebs-autoscale/"
109+
echo "creating artifacts/aws-ebs-autoscale.tgz with $(find ./ebs-autoscale/ -type f | wc -l) files from tmp/ebs-autoscale/"
110110
tar $VERBOSE -czf $ARTIFACT_PATH/aws-ebs-autoscale.tgz ./ebs-autoscale/
111111

112112
# add a copy of the release tarball for naming consistency
113-
echo "creating artifacts/amazon-ebs-autoscale.tgz with `find ./amazon-ebs-autoscale/ -type f | wc -l` files from tmp/amazon-ebs-autoscale/"
113+
echo "creating artifacts/amazon-ebs-autoscale.tgz with $(find ./amazon-ebs-autoscale/ -type f | wc -l) files from tmp/amazon-ebs-autoscale/"
114114
tar $VERBOSE -czf $ARTIFACT_PATH/amazon-ebs-autoscale.tgz ./amazon-ebs-autoscale
115115

116116
# add a retrieval script
@@ -126,7 +126,7 @@ for fn in `ls .`; do
126126
cd $TEMP_PATH/lambda/$fn
127127
[ -z $VERBOSE ] && P_QUIET='--quiet' || P_QUIET=''
128128
pip $P_QUIET install -t . -r requirements.txt
129-
echo "creating artifacts/lambda-${fn}.zip with `find . -type f | wc -l` files"
129+
echo "creating artifacts/lambda-${fn}.zip with $(find . -type f | wc -l) files"
130130
[ -z $VERBOSE ] && Z_QUIET='-q' || Z_QUIET=''
131131
zip $Z_QUIET -r $ARTIFACT_PATH/lambda-$fn.zip .
132132
done
@@ -151,13 +151,13 @@ zip $Z_QUIET -r $ARTIFACT_PATH/aws-ecs-additions.zip ./*
151151

152152

153153
# package container code
154-
echo "packaging container definitions with `find $SOURCE_PATH/containers -type f | wc -l` files"
154+
echo "packaging container definitions with $(find $SOURCE_PATH/containers -type f | wc -l) files"
155155
cd $SOURCE_PATH/containers
156156
zip $Z_QUIET -r $ARTIFACT_PATH/containers.zip ./*
157157

158158

159159
# add templates to dist
160-
echo "copying `find $SOURCE_PATH/templates/ -type f | wc -l` cloudformation templates"
160+
echo "copying $(find $SOURCE_PATH/templates/ -type f | wc -l) cloudformation templates"
161161
cp $VERBOSE -R $SOURCE_PATH/templates/. $TEMPLATES_PATH
162162

163163

0 commit comments

Comments
 (0)