snow · 2026.5.15 11:10 · 조회 2

Jenkins 빌드 알림 설정

이메일 알림

기본 이메일 설정

  1. Jenkins 관리 → 시스템 설정
  2. E-mail Notification 섹션
  3. SMTP 서버 정보 입력
항목예시
SMTP 서버smtp.gmail.com
포트587 (TLS)
사용자명your-email@gmail.com
비밀번호Gmail 앱 비밀번호

Job에 이메일 알림 추가

Freestyle Job: 빌드 후 조치 → E-mail Notification → 수신자 이메일 입력

Pipeline:

1post {2    failure {3        mail to: 'team@example.com',4             subject: "빌드 실패: ${env.JOB_NAME} #${env.BUILD_NUMBER}",5             body: "빌드 로그: ${env.BUILD_URL}"6    }7    success {8        mail to: 'team@example.com',9             subject: "빌드 성공: ${env.JOB_NAME} #${env.BUILD_NUMBER}",10             body: "정상적으로 완료되었습니다."11    }12}

Slack 알림

1. 플러그인 설치

Jenkins 관리 → 플러그인 관리에서 Slack Notification 플러그인 설치

2. Slack Incoming Webhook 생성

  1. Slack 워크스페이스 → 앱 추가 → Incoming WebHooks
  2. 알림 받을 채널 선택
  3. Webhook URL 복사 (예: https://hooks.slack.com/services/...)

3. Jenkins Credentials 등록

  1. Credentials → Add → Secret text
  2. Secret: Webhook URL
  3. ID: slack-webhook

4. Pipeline에서 Slack 알림 전송

1post {2    success {3        slackSend(4            channel: '#ci-notifications',5            color: 'good',6            message: "✅ 빌드 성공: *${env.JOB_NAME}* #${env.BUILD_NUMBER}\n<${env.BUILD_URL}|빌드 상세>"7        )8    }9    failure {10        slackSend(11            channel: '#ci-notifications',12            color: 'danger',13            message: "❌ 빌드 실패: *${env.JOB_NAME}* #${env.BUILD_NUMBER}\n<${env.BUILD_URL}|빌드 상세>"14        )15    }16}

알림 조건 설정

조건설명
always항상 알림
success성공 시만
failure실패 시만
unstable불안정 시 (테스트 실패 등)
changed이전 빌드 결과와 달라졌을 때
fixed실패에서 성공으로 복구됐을 때
1post {2    changed {3        // 상태 변경 시만 알림 (노이즈 감소)4        slackSend channel: '#ci', message: "상태 변경: ${currentBuild.result}"5    }6}

댓글

아직 댓글이 없습니다.

댓글을 작성하려면 로그인이 필요합니다.