jenkinsci/discord-notifier-plugin

ENV variables not working in description

arko-r opened this issue · 3 comments

I creating a Jenkins pipeline and am trying to send a message to Discord at the end.
The message is being sent, but I am unable to format the message the way I want.

I am trying to include the build number in the description using (note: I tried multiple variable names):
discordSend description: '**Build** ${env.BUILD_NUMBER} ${BUILD_NUMBER} $BUILD_NUMBER $ENV_BUILD_NUMBER ${ENV_BUILD_NUMBER}\n**Status**', link: env.BUILD_URL, result: currentBuild.currentResult, title: JOB_NAME, webhookURL: '<my_discord_webhook_url>'

But none of these are showing the build number. It just shows as: "Build ${env.BUILD_NUMBER} ${BUILD_NUMBER} $BUILD_NUMBER $ENV_BUILD_NUMBER ${ENV_BUILD_NUMBER}" in my Discord.
What is the correct way to include the build number in the description?

You have to put the description between double quotation marks "" instead of single quotation marks ''.

Thank you, that worked.
Could you update the example in the README so that it uses double quotation marks?

Sure, thanks for bringing that up