Created
August 4, 2015 23:22
-
-
Save adamgoucher/d111d9fff217f9a91897 to your computer and use it in GitHub Desktop.
quick scripts to deploy and then wait for completion of a build in aws codedeploy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ -f codedeploy.id ]; then | |
rm codedeploy.id | |
fi | |
aws deploy create-deployment \ | |
--application-name MY_APPLICATION \ | |
--deployment-group-name humans \ | |
--s3-location bucket=MY_BUCKET,bundleType=zip,key=MY_APPLICATION\/$revision.zip \ | |
--output text \ | |
--region us-west-2 > codedeploy.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zip -r ${BUILD_TIMESTAMP}.zip . | |
s3cmd put ${BUILD_TIMESTAMP}.zip s3://MY_BUCKET/MY_APPLICATION/ | |
echo "revision=${BUILD_TIMESTAMP}" > codedeploy.properties | |
rm ${BUILD_TIMESTAMP}.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws deploy get-deployment \ | |
--region us-west-2 \ | |
--deployment-id `cat codedeploy.id` > codedeploy.status | |
while (grep -q "\"status\": \"Created\"," codedeploy.status || grep -q "\"status\": \"InProgress\"," codedeploy.status) | |
do | |
sleep 10 | |
aws deploy get-deployment \ | |
--region us-west-2 \ | |
--deployment-id `cat codedeploy.id` > codedeploy.status | |
done | |
if grep -q "\"status\": \"Failed\"," codedeploy.status | |
then | |
exit 1 | |
elif grep -q "\"status\": \"Succeeded\"," codedeploy.status | |
then | |
exit 0 | |
else | |
exit 2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes: