한마디로
AWS CodeBuild는 소스 코드를 컴파일하고 단위 테스트를 실행하며 배포할 수 있는 결과물(아티팩트 Ex. war, jar 등)을 생성한다.
좀 더 자세히 말한다면마디로
- 가장 널리 사용되는 프로그래밍 언어 및 Apache Maven, Gradle 등과 같은 빌드 도구에 대한 사전 패키지 된 빌드 환경을 제공.
- 자체 빌드 도구를 사용하기 위해 AWS CodeBuild의 빌드 환경을 사용자 정의 할 수도 있음
- 빌드 부하에 따라 자동으로 확장
AWS CodeBuild 실행 방법
- AWS CodePipeline
- AWS Command Line Interface (AWS CLI)
- AWS SDK
- AWS CodeBuild HTTP API
AWS CodePipeline의 경우 파이프 라인 빌드 단계에 AWS CodeBuild를 빌드 작업으로 추가 할 수 있다.
AWS CodeBuild 실행 과정
Tips
이론적으로, Git과 AWS CLI를 Command Line으로 사용하실수 있다면 어떤 Region의 EB에도 원격에서 Deploy가 가능합니다. 제가 Travis-CI를 썼던 이유는 CodeBuild가 당시에 나오지 않았고, iOS Build를 지원하지 않았기 때문이었습니다. Travis CI를 쓰기 어려우시다면 CodeBuild에서 AWS CLI를 실행할수 있는 방법을 쓰시면 될것 같습니다.
http://docs.aws.amazon.com/.../use.../build-spec-ref.html...
위 문서를 보시면, CodeBuild의 spec을 이용하면 별도의 shell script 명령어를 실행 가능합니다. 이 스크립트의 pre_build에 AWS CLI를 pip로 설치하시고, post_build에서 빌드되어 나온 spring boot application을 AWS CLI의 EB deploy 명령어로 배포하면 가능할것 같습니다. 이 방법은 제가 travis ci를 쓴것만 다를 뿐이지 거의 동일한 방법입니다.
덤으로, travis ci도 private cloud 위한 enterprise 솔루션을 지원합니다. https://enterprise.travis-ci.com/ Build Specification Reference for AWS CodeBuild - AWS CodeBuild Provides reference information about build specifications (build specs) in AWS CodeBuild. DOCS.AWS.AMAZON.COM
https://github.com/Shippable/support/issues/2267 http://clarkie.io/devops/2015/11/10/configuring-aws-elastic-beanstalk-application.html
You can tell the EB CLI to deploy a ZIP or WAR file that you generate as part of a separate build process by adding the following lines to .elasticbeanstalk/config.yml in your project folder.
eb deploy survey-deploy-springboot-local
#branch-defaults:
# master:
# environment: my-env
# develop:
# environment: my-env-dev
deploy:
artifact: wallets-0.0.1-SNAPSHOT.war
deploy:
artifact: target/wallets-0.0.1-SNAPSHOT.war
global:
application_name: survey-deploy-springboot
default_ec2_keyname: dwjang
default_platform: Tomcat 8 Java 8
default_region: ap-northeast-2
profile: null
sc: git
D:\WS\Dev.WS.IntelliJ\wallets.elasticbeanstalk\config.yml
디버깅 노트
- UPLOAD_ARTIFACTS Phase에서 "Failed to upload artifacts: Invalid arn" 에러 발생
- 업로드 대상 S3가 코드빌드와 동일 리전에 있지 않을 때 이 에러가 발생함.