refactor(cd): 무중단 배포 스크립트 안정성 강화 및 오류 처리 개선 #268
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📄 Work Description
GitHub Actions를 이용한 스테이징 서버 무중단 배포(Blue-Green) 워크플로우를 개선했습니다.
💬 To Reviewers
이번 PR은 배포 안정성에 초점을 맞추었습니다. 아래 부분들을 중점적으로 확인해 주시면 좋겠습니다.
기존에는 docker ps 결과의 문자열을 grep과 awk로 파싱하여 불안정했습니다.
이를 docker ps -q --filter "publish=8080" 와 같이 docker의 필터 기능을 사용하도록 변경하여 명확성과 안정성을 높였습니다. OLD_CONTAINER_NAME과 NEW_CONTAINER_NAME 변수를 도입하여 이후의 docker run, docker rm 명령어의 가독성과 안정성을 확보했습니다.
docker ps -aq --filter "name=${OLD_CONTAINER_NAME}" 명령으로 삭제할 대상 컨테이너가 실제로 존재하는지 먼저 확인하도록 수정했습니다.
이를 통해 최초 배포 시(삭제할 구버전 컨테이너가 없는 경우) No such container 오류가 발생하지 않습니다.