mAtsea
mAtsea

Reputation: 67

How to post about build start into slack?

Can I use slackSend command in jenkins flow dsl if i have Jenkins ver. 1.656. I have enabled Slack Notification Plugin and it works fine in most cases, but i wish to display message when build starts.

Upvotes: 1

Views: 979

Answers (1)

mxr7350
mxr7350

Reputation: 1458

You can set up script in the pipeline, should be something like this:

def notify(status) {
    slackSend channel: "#jenkins", 
    color: '#d71f85',
    message: "${status}", 
    tokenCredentialId: 'yourtoken'
}

pipeline{
 ....
 stages{
    stage('Buildstart) {
      steps {
        notify("Build Started")
      }
    }
   ....
 }
}

Upvotes: 1

Related Questions