DevOps/AWS
클라이언트 배포 자동화 - 트러블 슈팅
WooKGOD
2023. 1. 13. 13:26
반응형
클라이언트 배포 파이프라인을 구축하고 배포 과정을 진행하는 도중 Build Stage에서 에러 발생
CodeBuild 과정에서 옵션으로 선택한 CloudWatch를 통해 로그 분석
DOWNLOAD_SOURCE State: FAILED 와 아래 줄의 YAML file does not exist를 보아 CodeBuild 생성 과정에서 필요한 buildspec.yml이 제대로 push되지 않았을 거라 생각해본다.
commit , push 다시 해준 뒤 다시 실행
message
"[Container] 2023/01/13 03:38:53 going inside waitForAgent
"
"[Container] 2023/01/13 03:38:53 Waiting for agent ping
"
"[Container] 2023/01/13 03:38:54 Waiting for DOWNLOAD_SOURCE
"
"[Container] 2023/01/13 03:38:55 Phase is DOWNLOAD_SOURCE
"
"[Container] 2023/01/13 03:38:55 finished waitForAgent
"
"[Container] 2023/01/13 03:38:55 CODEBUILD_SRC_DIR=/codebuild/output/src171540487/src
"
"[Container] 2023/01/13 03:38:55 YAML location is /codebuild/output/src171540487/src/buildspec.yml
"
"[Container] 2023/01/13 03:38:55 Found possible syntax errors in buildspec:
"
" The following keys cannot be identified:
"
" phase
"
"[Container] 2023/01/13 03:38:55 Setting HTTP client timeout to higher timeout for S3 source
"
"[Container] 2023/01/13 03:38:55 Processing environment variables
"
"[Container] 2023/01/13 03:38:55 No runtime version selected in buildspec.
"
"[Container] 2023/01/13 03:38:57 Moving to directory /codebuild/output/src171540487/src
"
"[Container] 2023/01/13 03:38:58 Configuring ssm agent with target id: codebuild:46be0a61-a0f3-499d-9fda-d26dee5382bb
"
"[Container] 2023/01/13 03:38:58 Successfully updated ssm agent configuration
"
"[Container] 2023/01/13 03:38:58 Registering with agent
"
"[Container] 2023/01/13 03:38:58 Phases found in YAML: 0
"
"[Container] 2023/01/13 03:38:58 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
"
"[Container] 2023/01/13 03:38:58 Phase context status code: Message:
"
"[Container] 2023/01/13 03:38:58 Entering execCommands
"
"[Container] 2023/01/13 03:38:58 Entering phase INSTALL
"
"[Container] 2023/01/13 03:38:58 Phase complete: INSTALL State: SUCCEEDED
"
"[Container] 2023/01/13 03:38:58 Phase context status code: Message:
"
"[Container] 2023/01/13 03:38:58 Entering phase PRE_BUILD
"
"[Container] 2023/01/13 03:38:58 Phase complete: PRE_BUILD State: SUCCEEDED
"
"[Container] 2023/01/13 03:38:58 Phase context status code: Message:
"
"[Container] 2023/01/13 03:38:58 Entering phase BUILD
"
"[Container] 2023/01/13 03:38:58 Phase complete: BUILD State: SUCCEEDED
"
"[Container] 2023/01/13 03:38:58 Phase context status code: Message:
"
"[Container] 2023/01/13 03:38:58 Entering phase POST_BUILD
"
"[Container] 2023/01/13 03:38:58 Phase complete: POST_BUILD State: SUCCEEDED
"
"[Container] 2023/01/13 03:38:58 Phase context status code: Message:
"
"[Container] 2023/01/13 03:38:58 exiting execCommands
"
"[Container] 2023/01/13 03:38:58 Expanding base directory path: client/build
"
"[Container] 2023/01/13 03:38:58 Assembling file list
"
"[Container] 2023/01/13 03:38:58 Expanding client/build
"
"[Container] 2023/01/13 03:38:58 Skipping invalid file path client/build
"
"[Container] 2023/01/13 03:38:58 Phase complete: UPLOAD_ARTIFACTS State: FAILED
"
"[Container] 2023/01/13 03:38:58 Phase context status code: CLIENT_ERROR Message: no matching base directory path found for client/build
"
앞선 YAML 파일 문제는 해결되었지만 새로운 에러가 발생했다...!
에러 로그 확인
1) The following keys cannot be indentified:
phase
2) Phase context status code: CLIENT_ERROR Message: no matching base directory path found for client/build
두 에러의 공통점이 Phase에 관련된 것을 확인하고 레퍼런스 확인
phases는 필수순서이고. 빌드 단계에서 CodeBuild가 실행하는 명령을 나타냅니다.
ex)
phases:
install:
runtime-versions:
java: corretto8
python: 3.x
ruby: "$MY_RUBY_VAR"
buildsepc.yml의 phase를 phases로 오타 수정 후 확인
더보기
version: 0.2
phases:
pre_build:
commands:
- cd client
- npm install
build:
commands:
- npm run build
artifacts:
files:
- '**/*'
base-directory: client/build
성공했다...
오늘의 교훈: 코드 작성할때 key, value 를 공식문서를 똑바로 읽고 집어 넣자
반응형