利用AWS Codebuild 从bitbucket获取代码构建并输出到S3上,再通过CodeDeploy 自动部署到测试或者生产环境
CodeBuild
支持分支
支持maven私服
自定义构建规范文件
CodeBuild的运行,需要向代码根目录中添加构建规范文件buildspec.yml
phases: install: commands: - cp ./deploy/settings.xml /root/.m2/settings.xml pre_build: commands: - cd src build: commands: - mvn clean && mvn install artifacts: files: - src/target/*.zip discard-paths: yes cache: paths: - '/root/m2/**/*'
build结果
CodeDeploy
支持回滚
客户端安装代理
支持ELB
支持自定义规范文件
CodeDeploy的运行,需要向代码根目录中添加构建规范文件deployspec.yml
files: - source: / destination: /home/ubuntu/app/cart permissions: - object: /home/ubuntu/epiclouds owner: ubuntu group: ubuntu hooks: BeforeInstall: - location: deploy/DeleteLib.sh timeout: 300 runas: ubuntu AfterInstall: - location: deploy/ChangePermission.sh timeout: 300 runas: ubuntu ApplicationStart: - location: deploy/start.sh timeout: 300 runas: ubuntu ApplicationStop: - location: deploy/stop.sh timeout: 300 runas: ubuntu
部署结果
定价
CodeBuild:根据计算类型定价,每月免费100分
CodeDeploy:免费