- Java 17+
./mvnw clean verify
./mvnw clean hpi:run
# Jenkins is fully up and running
- http://localhost:8080/jenkins/ 접속
- Pipeline 문법을 사용하려면 필요한 Pipeline 플러그인 설치
node {
stage('Notification') {
naver(
// required parameters
credentialId: 'naver-works-credential',
botId: env.NAVER_WORKS_BOT_ID,
channelId: env.NAVER_WORKS_CHANNEL_ID,
messageType: 'text',
// optional parameters
backgroundImageUrl: env.NAVER_WORKS_BG_URL,
contentActionLabel: 'Go to Jenkins',
contentActionLink: env.BUILD_URL,
simpleMessage: """test""".stripMargin()
)
}
}
./mvnw clean install
# target/naver-works.hpi
Manage Jenkins > Manage Plugins > Advanced > Deploy Plugin
NAVER Works Developer Console에서 앱 정보를 추가하고, Jenkins Credential을 추가한다.
// Jenkinsfile.groovy
node {
stage('Notification') {
List issues = [
[link: "https://jira.markruler.com/browse/MARK-31", title: "MARK-31", subtitle: "Jira Issue 31"],
[link: "https://jira.markruler.com/browse/MARK-32", title: "MARK-32", subtitle: "Jira Issue 32"]
]
naver(
// required parameters
credentialId: 'naver-works-credential',
botId: env.NAVER_WORKS_BOT_ID,
channelId: env.NAVER_WORKS_CHANNEL_ID,
messageType: 'list_template',
// optional parameters
backgroundImageUrl: env.NAVER_WORKS_BG_URL,
contentActionLabel: 'Go to Jenkins',
contentActionLink: env.BUILD_URL,
messages: issues,
simpleMessage: """${minute}분 뒤 'A'가 재시작됩니다.
|
|'A' will restart in ${minute} minutes.
|""".stripMargin()
)
}
}
Manage Jenkins > Configure System > Jenkins Location > Jenkins URL
구성은 별도로 설정하지 않았다면 기본적으로 localhost
로 설정된다.
그럼 BUILD_URL
환경 변수는 생성되지 않는다.
로그를 확인해보면 unconfigured-jenkins-location
과 같은 메시지를 확인할 수 있다.
Jenkins URL
에 젠킨스 서비스 도메인을 입력하거나,
로컬 환경에서 테스트할 경우 http://127.0.0.1:8080/jenkins/
와 같이 Loopback 주소를 입력한다.
node {
stage('Notification') {
naver(
// required parameters
credentialId: 'naver-works-credential',
botId: env.NAVER_WORKS_BOT_ID,
channelId: env.NAVER_WORKS_CHANNEL_ID,
messageType: 'text',
// optional parameters
simpleMessage: """${minute}분 뒤 'A'가 재시작됩니다.
|
|'A' will restart in ${minute} minutes.
|""".stripMargin()
)
}
}
node {
stage('Notification') {
naver(
// required parameters
credentialId: 'naver-works-credential',
botId: env.NAVER_WORKS_BOT_ID,
channelId: env.NAVER_WORKS_CHANNEL_ID,
messageType: 'link',
// optional parameters
backgroundImageUrl: env.NAVER_WORKS_BG_URL,
contentActionLabel: 'Go to Jenkins',
contentActionLink: env.BUILD_URL,
simpleMessage: 'Changes have been deployed.'
)
}
}
node {
stage('Notification') {
List issues = [
[link: "https://jira.markruler.com/browse/MARK-31", title: "MARK-31", subtitle: "Jira Issue 31"],
[link: "https://jira.markruler.com/browse/MARK-32", title: "MARK-32", subtitle: "Jira Issue 32"]
]
naver(
// required parameters
credentialId: 'naver-works-credential',
botId: env.NAVER_WORKS_BOT_ID,
channelId: env.NAVER_WORKS_CHANNEL_ID,
messageType: 'list_template',
// optional parameters
backgroundImageUrl: env.NAVER_WORKS_BG_URL,
contentActionLabel: 'Go to Jenkins',
contentActionLink: env.BUILD_URL,
messages: issues
)
}
}
node {
stage('Notification') {
List issues = [
[link: "https://jira.markruler.com/browse/MARK-1", title: "MARK-1", subtitle: "not null"],
[link: "https://jira.markruler.com/browse/MARK-2", title: "MARK-2", subtitle: "subtitle2"],
[link: "https://www.jenkins.io/", title: "title-3", subtitle: "subtitle3"]
]
naver(
// required parameters
credentialId: 'naver-works-credential',
botId: env.NAVER_WORKS_BOT_ID,
channelId: env.NAVER_WORKS_CHANNEL_ID,
messageType: 'carousel',
// optional parameters
backgroundImageUrl: env.NAVER_WORKS_BG_URL,
contentActionLabel: 'Go to Jenkins',
contentActionLink: env.BUILD_URL,
messages: issues
)
}
}