Skip to content

Commit

Permalink
Merge pull request #537 from LiskHQ/slack-lisk-ci-hub
Browse files Browse the repository at this point in the history
Post Slack notifications to lisk-ci-hub channel
  • Loading branch information
fchavant authored Mar 9, 2018
2 parents 805653b + d3828d1 commit b08dcc5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@ def get_build_info() {
def slack_send(color, message) {
/* Slack channel names are limited to 21 characters */
CHANNEL_MAX_LEN = 21
CHANNEL_SUFFIX = '-jenkins'

channel = "${env.JOB_NAME}".tokenize('/')[0]
channel_len = CHANNEL_MAX_LEN - CHANNEL_SUFFIX.size()
if ( channel.size() > channel_len ) {
channel = channel.substring(0, channel_len)
channel = channel.replace('lisk-', 'lisk-ci-')
if ( channel.size() > CHANNEL_MAX_LEN ) {
channel = channel.substring(0, CHANNEL_MAX_LEN)
}
channel += CHANNEL_SUFFIX
echo "[slack_send] channel: ${channel} "

echo "[slack_send] channel: ${channel} "
slackSend color: "${color}", message: "${message}", channel: "${channel}"
}

Expand Down

0 comments on commit b08dcc5

Please sign in to comment.