-
Notifications
You must be signed in to change notification settings - Fork 304
/
config-slack.groovy
executable file
·26 lines (23 loc) · 1.07 KB
/
config-slack.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!groovy
//-------------------------------------------------------------------
// @copyright 2018 DennyZhang.com
// Licensed under MIT
// https://www.dennyzhang.com/wp-content/mit_license.txt
//
// File: slack_notification.groovy
// Author : Denny <https://www.dennyzhang.com/contact>
// Description :
// Link: https://cheatsheet.dennyzhang.com/cheatsheet-jenkins-groovy-a4
// --
// Created : <2018-04-20>
// Updated: Time-stamp: <2019-04-30 16:07:20>
//-------------------------------------------------------------------
// https://github.com/jenkinsci/slack-plugin/blob/master/src/main/java/jenkins/plugins/slack/SlackNotifier.java
import jenkins.model.Jenkins
import jenkins.plugins.slack.SlackNotifier.*
// def slack = Jenkins.instance.getDescriptorByType(jenkins.plugins.slack.SlackNotifier.DescriptorImpl)
def slack = Jenkins.instance.getExtensionList('jenkins.plugins.slack.SlackNotifier$DescriptorImpl')[0]
slack.tokenCredentialId = 'slack_token_passwd'
slack.baseUrl = 'https://vmware.slack.com/services/hooks/jenkins-ci'
slack.save()
println 'Slack global settings configured.'