Skip to content

Commit

Permalink
Add retries to s3cmd sync
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Kridner committed Nov 6, 2013
1 parent 4650205 commit 37277e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ec2-build/build-buildroot.txt
Expand Up @@ -59,7 +59,7 @@ write_files:
path: /usr/local/bin/server.sh
permissions: '0755'
- content: |
#!/bin/sh
#!/bin/bash
#set -e
set -x
BUILD=/mnt/build
Expand Down Expand Up @@ -97,7 +97,10 @@ write_files:
ls $OUTPUT | perl -pe 's/^(.*)$/<li><a href="$1">$1<\/a><\/li>/' >>index.html
echo "</ul></body></html>" >>index.html
node -pe "c=require('$HOME/config');require('fs').readFileSync('/usr/local/share/s3cfg').toString().replace(/_AK_/,c.client.accessKeyId).replace(/_SK_/,c.client.secretAccessKey);" > $HOME/.s3cfg
s3cmd sync -P $OUTPUT/ s3://beagle/buildroot/$DATE/
NEXT_WAIT_TIME=0
until s3cmd sync -P $OUTPUT/ s3://beagle/buildroot/$DATE/ || [ $NEXT_WAIT_TIME -eq 4 ]; do
sleep $(( NEXT_WAIT_TIME++ ))
done
s3cmd put -P $BUILD/build.log s3://beagle/buildroot/$DATE/
node -e "c=require('$HOME/config');a=require('aws-sdk');a.config.update(c.client);s=new a.SES.Client(c.client);s.sendEmail({Source:c.email.from,Destination:{ToAddresses:c.email.to},Message:{Subject:{Data:'[beagle-validation] Completed build-buildroot.sh'},Body:{Text:{Data:'http://beagle.s3.amazonaws.com/buildroot/$DATE/index.html\nhttp://github.com/jadonk/validation-scripts'}}}},function(err){console.log('err = ' + err);});"
echo !!!! COMPLETED build-buildroot !!!!
Expand Down

0 comments on commit 37277e0

Please sign in to comment.