2015年11月30日 星期一

Codeship CI/CD for AWS Opswork script


Test

setup
jdk_switcher use oraclejdk8
echo $JAVA_HOME
echo $JRE_HOME
java -version
mvn --version
Configure Test
mvn -B package site -Pqa

Deployment

custom script - do update aws cli and get rev for build package
pip install botocore --upgrade
pip install awscli --upgrade
VERSION=`git rev-parse --short HEAD`
cd target
ZIP_FILE=$(ls -rt *.zip | tail -1)
ZIP_FILE_VERSION=${ZIP_FILE%.*}-${VERSION}.zip
echo "$ZIP_FILE_VERSION" "$ZIP_FILE"
cd ..
S3 - put to AWS S3 - two file, version file and latest
Local Path:./target/${ZIP_FILE}
S3 Bucket:backetabc/dist/${ZIP_FILE_VERSION}

Local Path:./target/${ZIP_FILE}
S3 Bucket:backetabc/dist/${ZIP_FILE}
custom script again - trigger aws opswork
# rolling deployment
git clone https://github.com/awslabs/reinvent2014-scalable-site-management.git
cd reinvent2014-scalable-site-management/opsworks-easy-deploy
pip install -r requirements.txt
python easy_deploy.py --opsworks-region us-east-1 --elb-region us-west-2 deploy --application=root rolling --stack-name={stack name} --layer-name='${layer name}' --comment="Rolling deployment to all web api servers" --timeout 600

沒有留言:

張貼留言