카테고리 없음

Jenkins Mattermost 연결

bay07 2024. 8. 7. 20:18

1. Jenkins Plugin 설치

Mattermost Notification 설치

 

2. Mattermost Webhook 설정

Mattermost 설정 → 통합 → 전체 Incoming Webhook → Incoming Webhook 추가

Jenkins 알림 받을 채널 선택 및 채널 고정

 

3. Jenkins System 설정

System → Global Mattermost Notifier Settings

 

Endpoint: mattermost webhook 입력

Channel: Incoming Webhook을 추가할 때 설정했던 채널 이름

Build Server URL: Jenkins 주소 (자동으로 입력되어 있을 것이다.)

 

 

 

4. Jenkins Scripts 설정

아래는 예시 파일로 stages 아래 post 내 mattermostSend에 팀 에 알맞게 수정하여 사용

pipeline {
    agent any
    stages {
        stage('test') {
            steps {
             echo 'Jenkins Mattermost Connection' 
            }
        }
    }
    
    post {
        success {
        	script {
                mattermostSend (color: 'good', 
                message: "배포 성공   :gmqwhr_:   [우리팀URL]()",
                )
            }
        }
        failure {
        	script {
                mattermostSend (color: 'danger', 
                message: "배포 실패   :please1: "
                )
            }
        }
    }
}

 

5. 사용 결과