Discord 배포·승격 알림 jq 파싱 실패 수정 (전송 불능) - #660
Conversation
- ${DISCORD_USER_MAP:-{}} 는 secret 이 설정돼 있으면 bash 가 뒤에 } 를 덧붙여(...}}) jq 가 파싱 실패(exit 5) → set -eo pipefail 로 curl 전에 step 이 죽어 알림이 전송되지 않음
- 역설적으로 secret 미설정일 때만 우연히 동작(빈 {})해, #659 머지 후 매 배포·승격 알림이 조용히 실패
- guard 로 분리: DISCORD_MAP 에 담고 비었으면 {} 로 채운 뒤 jq 에 넘김
- deploy.yml 3블록(성공·실패·릴리즈) + promote.yml 2블록(성공·실패) 전부 적용
- PR #659 검증이 로컬에 jq 없어 python 으로 렌더링만 확인하느라 이 라인을 실제로 안 돌린 사각
|
Slack 스레드 연동용 메타데이터입니다. slack-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Slack 알림 연동이 끊깁니다. |
Walkthroughdeploy.yml과 promote.yml의 Discord 알림 스텝(성공/실패/릴리즈)에서 DISCORD_USER_MAP 값을 jq에 전달하는 방식을 변경. 인라인 기본값 ChangesDiscord 알림 DISCORD_MAP 보정
Estimated code review effort: 1 (Trivial) | ~5 minutes 관련 이슈: 없음 한 줄 코멘트: 🐹: "중괄호 하나 잘못 놓으면 jq가 삐치는 법이지, 이제 안심하고 배포하자!" 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/deploy.yml (1)
633-635: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff중복 로직, composite action으로 뽑아내면 이런 버그 재발도 막을 수 있어요.
동일한
DISCORD_MAP보정 + jq 조회 + curl POST 블록이 deploy.yml 3곳, promote.yml 2곳에 그대로 복붙되어 있습니다. 이번처럼 로직에 버그가 있으면 5곳을 전부 찾아 고쳐야 하니, 다음에 또 하나만 고치고 넘어가는 실수가 나올 수 있어요.
.github/actions/discord-notify같은 composite action으로 분리해webhook_url,user_map,text정도를 입력받게 하면 한 곳만 고치면 되고 테스트도 쉬워집니다. 참고: GitHub Docs - Creating a composite action당장 급한 건 아니니 여유 있을 때 리팩토링해보시는 걸 추천드려요.
Also applies to: 676-678, 782-784
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/deploy.yml around lines 633 - 635, The Discord notification logic is duplicated across multiple workflow steps, so the same fix has to be repeated in several places. Extract the repeated DISCORD_MAP normalization, jq lookup, and curl POST behavior into a reusable composite action such as discord-notify, and have the deploy and promote workflows call it with webhook_url, user_map, and text inputs to centralize the logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.github/workflows/deploy.yml:
- Around line 633-635: The Discord notification logic is duplicated across
multiple workflow steps, so the same fix has to be repeated in several places.
Extract the repeated DISCORD_MAP normalization, jq lookup, and curl POST
behavior into a reusable composite action such as discord-notify, and have the
deploy and promote workflows call it with webhook_url, user_map, and text inputs
to centralize the logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: dd075730-aa08-4145-b39f-1a93f2c5780d
📒 Files selected for processing (2)
.github/workflows/deploy.yml.github/workflows/promote.yml
Situation
Task
Action
jq: parse error: Unmatched '}' at column 69(exit 5)로 curl 전에 죽는 걸 확인했다.continue-on-error: true라 배포 job 만 계속돼 "배포 성공 + 알림 없음"이 됐다.${DISCORD_USER_MAP:-{}}다. bash 는 이 파라미터 확장의 기본값{}를 제대로 못 닫아, secret 이 설정돼 있으면 값 뒤에 stray}를 덧붙인다(...}}). 그 깨진 JSON 을 jq 가 거부한다.{}로 동작하고, 설정돼 있으면 매번 깨진다.DISCORD_USER_MAP이 설정돼 있어 머지 후 모든 배포·승격 알림이 조용히 실패했다.DISCORD_MAP에 값을 담고 비었을 때만{}로 채운 뒤 jq 에 넘긴다. deploy.yml 3블록(성공·실패·릴리즈)과 promote.yml 2블록(성공·실패) 전부 동일 적용.Result
}없는 정상 JSON, 미설정 시{}, 둘 다 유효.echo ... | jq라인은 실행되지 않았다. 그 사각에 정확히 걸렸다. 후속으로 알림 로직 검증에 실제 jq 실행 경로를 포함할지 검토가 필요하다.연관 이슈
Summary by CodeRabbit