zioinfo-mail/.claude/skills/cicd-pipeline-orchestrator/SKILL.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

161 lines
4.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: cicd-pipeline-orchestrator
description: "GUARDiA CI/CD 파이프라인 전체 구축 오케스트레이터. Jenkins 초기 설정 → 5개 repo Jenkinsfile 작성 → deploy_server.py 업데이트 → 메신저 알림 연동까지 완전한 CI/CD 파이프라인을 구축한다. 다음 상황에서 반드시 사용: (1) 'CI/CD 파이프라인 구축', 'Jenkins 설정', 'Jenkinsfile 만들어줘'; (2) '빌드 자동화', '배포 자동화', '파이프라인 완성'; (3) 빌드 실패 알림, 롤백 설정; (4) 다시 실행, 업데이트, 수정, 보완."
---
# GUARDiA CI/CD 파이프라인 오케스트레이터
**실행 모드:** 하이브리드
- Phase 1(Jenkins 초기화): 서브 에이전트
- Phase 2(Jenkinsfile 작성 × 5): 병렬 서브 에이전트
- Phase 3(deploy_server + 알림): 에이전트 팀
---
## 현재 인프라 현황
```
Gitea (port 3000, SSL) → 5개 독립 repo 존재
Webhook(port 9999) → deploy_server.py 실행 중
Jenkins(port 8080) → 설치됨, 초기 설정 미완
서버 (101.79.17.164) → Ubuntu 24.04
```
## 파이프라인 전체 흐름
```
git push (개발자)
Gitea webhook → port 9999 (deploy_server.py)
↓ ↓
즉시 배포 Jenkins Job 트리거
(간단한 경우) (복잡한 빌드)
↓ ↓
restart Build → Test → Deploy → Notify
```
---
## Phase 0: 사전 확인
```bash
# Jenkins 접근 확인
curl -sf http://localhost:8080/api/json 2>/dev/null && echo "OK" || echo "Jenkins 설정 필요"
# 초기 비밀번호 확인 (미설정 시)
sudo cat /var/lib/jenkins/secrets/initialAdminPassword 2>/dev/null
# 서비스 상태
systemctl is-active jenkins
```
---
## Phase 1: Jenkins 초기 설정 (jenkins-initializer)
**실행 모드: 서브 에이전트**
```
1. Jenkins 초기 비밀번호 확인 → admin 패스워드 변경
2. 필수 플러그인 설치: git, pipeline, gitea, credentials-binding, nodejs, http_request
3. Gitea credential 등록 (gitea-token)
4. 글로벌 환경변수 설정 (ITSM_BASE_URL, SERVER_HOST 등)
5. Gitea webhook → Jenkins trigger 설정
```
---
## Phase 2: Jenkinsfile 작성 (pipeline-architect × 5, 병렬)
**실행 모드: 병렬 서브 에이전트**
`jenkinsfile-generator` 스킬 참조하여 5개 시스템 동시 작성:
| 시스템 | 저장 경로 | 스테이지 |
|--------|----------|---------|
| zioinfo-web | `workspace/zioinfo-web/Jenkinsfile` | checkout→npm→mvn→deploy |
| guardia-itsm | `workspace/guardia-itsm/Jenkinsfile` | checkout→pip→pytest→rsync |
| guardia-manager | `workspace/guardia-manager/Jenkinsfile` | checkout→npm→copy |
| guardia-messenger | `workspace/guardia-messenger/Jenkinsfile` | checkout→validate→eas |
| guardia-docs | `workspace/guardia-docs/Jenkinsfile` | checkout→copy |
---
## Phase 3: 배포 + 알림 (에이전트 팀)
**실행 모드: deploy-scripter + notification-wirer 협업**
### deploy-scripter 담당
```python
# deploy_server.py 업데이트
# guardia-manager, guardia-docs 배포 함수 추가
# REPO_ROUTES 딕셔너리에 새 repo 매핑
```
### notification-wirer 담당
```groovy
// vars/notify.groovy (Jenkins Shared Library)
// ITSM webhook으로 빌드 결과 전송
// 각 Jenkinsfile의 post 블록에 notifyITSM() 호출 추가
```
---
## Phase 4: 각 Repo에 Jenkinsfile 커밋 + push
```bash
for repo in zioinfo-web guardia-itsm guardia-manager guardia-messenger guardia-docs; do
cd C:\GUARDiA\repos\$repo
git add Jenkinsfile
git commit -m "ci: add Jenkins pipeline"
git push origin main
done
```
→ Gitea webhook → Jenkins job 자동 실행 검증
---
## Phase 5: 전체 파이프라인 검증
```bash
# Jenkins job 상태 확인 (Jenkins API)
curl -sf http://localhost:8080/job/zioinfo-web/lastBuild/api/json | python3 -m json.tool
# 최근 배포 로그 확인
tail -20 /var/log/zioinfo/deploy.log
```
---
## 에러 핸들링
| 오류 | 원인 | 해결 |
|------|------|------|
| Jenkins 포트 접근 불가 | 방화벽 또는 서비스 중단 | `systemctl restart jenkins` |
| 플러그인 설치 실패 | 네트워크 또는 버전 | Jenkins Update Center 확인 |
| Gitea webhook 미트리거 | secret 불일치 | deploy_server.py SECRET 확인 |
| EAS 빌드 실패 | EXPO_TOKEN 만료 | expo.dev에서 토큰 갱신 |
---
## 테스트 시나리오
**정상 흐름:**
1. `workspace/guardia-itsm/`에서 코드 수정 → `repos/guardia-itsm/`에 push
2. Gitea webhook → Jenkins `guardia-itsm` job 트리거
3. Build → Test → Deploy → ITSM 메신저 알림 수신 확인
**에러 흐름:**
- mvn build 실패 → Jenkins 빌드 실패 표시 → ITSM 메신저 "❌ 빌드 실패" 알림
---
## should-trigger
- "CI/CD 파이프라인 구축해줘"
- "Jenkins job 만들어줘"
- "Jenkinsfile 작성해줘"
- "빌드 실패 알림 연동"
- "guardia-itsm 파이프라인 완성"