nessHaf
nessHaf

Reputation: 137

Sending slack message in jenkins with ${currentBuild.number}

Hey i've been trying to send message with my number of build in a slack message in my jenkins pipeline using slacksend like this

 slackSend channel: 'developer-team', message: 'The unit tests have been successful for Build N°: ${currentBuild.number}'

but the message i get from slack is this way :

The unit tests have been successful for Build N°: ${currentBuild.number}

i don't know how to fix to get the appropriate message

Upvotes: 0

Views: 1165

Answers (1)

Sourav
Sourav

Reputation: 3392

Try like this:

slackSend channel: '#notification', color: 'good', message: "The unit tests have been successful for Build N°: ${env.BUILD_NUMBER}", teamDomain: 'testnotifgroup', tokenCredentialId: 'slack-token'

Use double quotes " " to wrap your message

Upvotes: 2

Related Questions