03. AWS CODE BUILD

01. CODE BUILD 이해하기

01) 코드빌드란 ?

소스코드를 컴파일 하고 테스트를 실행하며, 배포할 준비가 된 소프트웨어 패키지를 생성하는 완전 관리형 연속 통합 서비스

  • 완전 관리형 인만큼 빌드 서버를 별도로 구성할 필요가 없다.
  • 컴파일 과 빌드가 필요 없다면 해당 제품은 필요하지 않다. ( 단순한 HTML 이나, CloudFront 와 같은 제품)
  • 기본적인 요금 정책은 빌드를 수행하는 경우 비용이 발생한다. (상시 ON 이 아니다. )
  • 빌드 스펙은 YAML 을 통해 파이프 라인을 구성하여 제공한다.

02) Code Build 사용 방법

(01) 코드 빌드 접근 방법

  • Management Console
  • CLI
  • SDK
  • Code Pipeline

(02) 결과물을 토대로 보는 Code Build PipeLine

[CodeCommit] — 소스 코드 불러옴 —> [Code Build] —- [빌드된 이미지나 결과 파일] 저장 —–> [S3]

  • Code Build 를 수행하기 위해서, 별도의 빌드 서버를 구성하거나, 부하에 따라 늘릴 필요는 없다.
  • S3에서는 버전이 기록되는 만큼, 이전 버전으로 쉽게 돌아갈 수 있다.
  • S3 는 기본적으로 암호화 되어 저장한다.

(03) 일반적인 사용 방법

  1. 코드 빌드를 실행한다.
  2. 코드 빌드는 코드커밋이나 깃 으로 부터 소스코드를 불러와 빌드 한다.
  3. 빌드 과정에서 발생되는 파일은 S3 에, 로그들은 CloudWatch 에 기록 한다.
  4. 사용자는 코드빌드 혹은 클라우드 와치를 통해 결과를 확인한다.

(04) Cloud Watch 의 활용성

  1. 코드 빌드의 결과물을 보는데 사용 한다. (로그)
  2. 클라우드 와치 이벤트를 이용하면 2가지에서 활용이 가능하다.
    • 소스 코드가 커밋되는 로그를 받아, 코드 빌더를 실행 시켜 커밋과 동시에 빌드 결과를 확인 할 수 있다.
    • 빌드 완료나 빌드 상황에 따라, 사용자에게 슬랙을 통한 알림 서비스 등이 가능하다.

[Code Build] 에서 빌드 스테이지와 테스트 스테이지를 정한 파이프 라인을 구성한다.

03) Build Spec 탐색 하기

(01) 빌드 절차

빌드 스펙은 Build 과정에서 수행해야하는 작업들을 모아놓은 파일 이다. 그렇기에 일반적인 빌드 절차에 따른 파일을 구성한다.

  1. 클라우드 와치 이벤트나, 사용자에 의해 빌드 요청을 받는다.
  2. 빌드 서버를 구성한다.
  3. 빌드 대상이 되는 소스 코드를 다운로드 한다.
  4. 빌드 과정에서 필요한 도구들을 설치 한다. (Install )
    • ex) Maven , Java, 파이썬 특정 버전 , 프레임워크 등 설치
  5. 빌드 과정에서 필요한 부분들을 미리들을 미리 수행 한다. (Pre-Build)
    • 연관 소스 빌드 / 연계 사이트 로그인 정보 등록 / 환경 변수 등록 등
  6. 빌드를 수행 한다. (Build)
    • 실제 빌드 수행
  7. 빌드된 파일을 처리 한다. (Post-Build)
    • 결과 파일 처리 ( Java 의 경우 Jar 변환 등의 작업)
  8. 결과 파일을 저장소에 업로드 한다. ( Upload Artifcats)
    • 빌드 머신은 임시로 프로비저닝 된 만큼 영구적인 저장소로 파일 이동
  9. 작업을 완료 한다.

(02) 빌드 스펙 코드 양식

[기본 소스코드 양식]

version: 0.2

run-as: Linux-user-name

env:
  variables:
    key: "value"
    key: "value"
  parameter-store:
    key: "value"
    key: "value"
  git-credential-helper: yes

proxy:
    upload-artifacts: yes
    logs: yes
            
phases:
  install:
    run-as: Linux-user-name
    runtime-versions:
      runtime: version
      runtime: version
    commands:
      - command
      - command
    finally:
      - command
      - command
  pre_build:
    run-as: Linux-user-name
    commands:
      - command
      - command
    finally:
      - command
      - command
  build:
    run-as: Linux-user-name
    commands:
      - command
      - command
    finally:
      - command
      - command
  post_build:
    run-as: Linux-user-name
    commands:
      - command
      - command
    finally:
      - command
      - command
artifacts:
  files:
    - location
    - location
  name: artifact-name
  discard-paths: yes
  base-directory: location
  secondary-artifacts:
    artifactIdentifier:
      files:
        - location
        - location
      name: secondary-artifact-name
      discard-paths: yes
      base-directory: location
    artifactIdentifier:
      files:
        - location
        - location
      discard-paths: yes
      base-directory: location
cache:
  paths:
    - path
    - path

[AWS Code Sample]

version: 0.2

phases:
  install:
    runtime-versions:
      java: corretto11
  pre_build:
    commands:
      - echo Nothing to do in the pre_build phase...
  build:
    commands:
      - echo Build started on `date`
      - mvn install
  post_build:
    commands:
      - echo Build completed on `date`
artifacts:
  files:
    - target/messageUtil-1.0.jar

02. Code Build 실습

https://docs.aws.amazon.com/ko_kr/codebuild/latest/userguide/getting-started-cli-create-source-code.html

[ 추후 심화에서 정리 예정 ]

1,102 thoughts on “03. AWS CODE BUILD”

  1. mexican pharmaceuticals online [url=https://mexicandeliverypharma.online/#]mexican border pharmacies shipping to usa[/url] pharmacies in mexico that ship to usa

    응답
  2. mexico drug stores pharmacies [url=https://mexicandeliverypharma.online/#]buying prescription drugs in mexico online[/url] buying prescription drugs in mexico online

    응답
  3. pharmacies in mexico that ship to usa [url=https://mexicandeliverypharma.online/#]mexican online pharmacies prescription drugs[/url] buying prescription drugs in mexico online

    응답
  4. medication from mexico pharmacy [url=https://mexicandeliverypharma.online/#]mexican online pharmacies prescription drugs[/url] mexican online pharmacies prescription drugs

    응답
  5. buying prescription drugs in mexico [url=http://mexicandeliverypharma.com/#]reputable mexican pharmacies online[/url] mexican border pharmacies shipping to usa

    응답
  6. mexican border pharmacies shipping to usa [url=https://mexicandeliverypharma.com/#]mexican online pharmacies prescription drugs[/url] п»їbest mexican online pharmacies

    응답
  7. mexican online pharmacies prescription drugs [url=https://mexicandeliverypharma.online/#]mexico pharmacies prescription drugs[/url] mexican pharmaceuticals online

    응답
  8. mexican border pharmacies shipping to usa [url=http://mexstarpharma.com/#]mexican online pharmacies prescription drugs[/url] mexican mail order pharmacies

    응답
  9. mexico pharmacies prescription drugs [url=https://mexstarpharma.online/#]purple pharmacy mexico price list[/url] mexican online pharmacies prescription drugs

    응답
  10. mexican border pharmacies shipping to usa [url=https://mexicopharmacy.cheap/#]pharmacies in mexico that ship to usa[/url] buying prescription drugs in mexico

    응답
  11. best online pharmacies in mexico [url=https://mexicopharmacy.cheap/#]mexican online pharmacies prescription drugs[/url] mexican border pharmacies shipping to usa

    응답
  12. pharmacie en ligne avec ordonnance [url=https://clssansordonnance.icu/#]acheter mГ©dicament en ligne sans ordonnance[/url] pharmacie en ligne france pas cher

    응답
  13. Hello just wanted to give you a quick heads up. The words in your post seem to be running off the screen in Ie. I’m not sure if this is a format issue or something to do with web browser compatibility but I thought I’d post to let you know. The design and style look great though! Hope you get the problem resolved soon. Kudos|

    응답
  14. This design is spectacular! You most certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Wonderful job.
    I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool!

    응답
  15. I blog frequently and I seriously thank you for your information. This article has really peaked my interest. I am going to take a note of your site and keep checking for new details about once a week. I subscribed to your Feed as well.

    응답
  16. An impressive share! I have just forwarded this onto a coworker who was doing a little research on this. And he actually bought me lunch because I discovered it for him… lol. So let me reword this…. Thanks for the meal!! But yeah, thanks for spending time to discuss this topic here on your website.

    응답
  17. I blog frequently and I genuinely appreciate your content. Your article has truly peaked my interest. I will take a note of your site and keep checking for new information about once a week. I subscribed to your RSS feed too.

    응답

Leave a Comment