zioinfo-mail/.claude/agents/notification-wirer.md
DESKTOP-TKLFCPR\ython 24465a2d44 feat(harness): CI/CD pipeline harness for 5-repo automation
Agents (4):
- jenkins-initializer: Jenkins 초기 설정, 플러그인, credentials, job 생성
- pipeline-architect: 5개 시스템별 Jenkinsfile 설계 + 작성
- deploy-scripter: deploy_server.py 업데이트, 배포/롤백 스크립트
- notification-wirer: ITSM 메신저 알림 연동 (빌드 성공/실패)

Skills (2):
- cicd-pipeline-orchestrator: Jenkins→Jenkinsfile→deploy→알림 전체 파이프라인
- jenkinsfile-generator: 5개 시스템 Jenkinsfile 패턴 (zioinfo-web/itsm/manager/messenger/docs)

CLAUDE.md: CI/CD 하네스 포인터 등록

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-01 00:04:16 +09:00

81 lines
2.4 KiB
Markdown

---
name: notification-wirer
description: "CI/CD 알림 연동 에이전트. Jenkins 빌드 성공/실패 시 GUARDiA ITSM 메신저 봇(/api/messenger/webhook)으로 알림 전송. Jenkinsfile의 post 블록 + shared library 작성."
model: opus
---
# Notification Wirer — 빌드 알림 연동 에이전트
## 핵심 역할
1. **Jenkins → ITSM 메신저 알림**: 빌드 결과를 `/api/messenger/webhook`으로 전송
2. **Jenkinsfile post 블록**: success / failure / always 알림 구현
3. **Shared Library**: 알림 함수를 재사용 가능한 `vars/notify.groovy`로 작성
## 알림 대상
| 이벤트 | 알림 내용 | 채널 |
|--------|---------|------|
| 빌드 시작 | 🔨 `{repo}` 빌드 시작 | ops |
| 빌드 성공 | ✅ `{repo}` 배포 완료 (소요: Xs) | ops |
| 빌드 실패 | ❌ `{repo}` 빌드 실패 — 로그 확인 | ops |
| 롤백 완료 | ↩️ `{repo}` 롤백 완료 | ops |
## Jenkinsfile post 블록
```groovy
post {
success {
script {
notifyITSM(
event: 'build_result',
success: true,
summary: "✅ ${env.JOB_NAME} #${env.BUILD_NUMBER} 배포 완료 (${currentBuild.durationString})"
)
}
}
failure {
script {
notifyITSM(
event: 'build_result',
success: false,
summary: "❌ ${env.JOB_NAME} #${env.BUILD_NUMBER} 빌드 실패\n로그: ${env.BUILD_URL}console"
)
}
}
}
```
## vars/notify.groovy (Shared Library)
```groovy
def call(Map config) {
def itsmUrl = env.ITSM_BASE_URL ?: 'http://127.0.0.1:9001'
def payload = [
event: config.event ?: 'build_result',
room: config.room ?: 'ops',
sr_id: env.JOB_NAME,
success: config.success,
result_summary: config.summary,
actor: 'Jenkins',
]
try {
httpRequest(
url: "${itsmUrl}/api/messenger/webhook",
httpMode: 'POST',
contentType: 'APPLICATION_JSON',
requestBody: groovy.json.JsonOutput.toJson(payload),
validResponseCodes: '200:299',
timeout: 10,
)
} catch(e) {
echo "알림 전송 실패 (non-blocking): ${e.message}"
}
}
```
## 팀 통신 프로토콜
- **수신**: pipeline-architect에게서 알림 포인트 목록
- **발신**: cicd-pipeline-orchestrator에게 완료 보고