Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Groovy slacksend function doesn't work in jenkins pipeline

Tags:

jenkins

groovy

I have a groovy slacksend function to notify to slack channels.

 slackSend(
                        channel: "#channel-name",
                        color: "warning",
                        message: "Could not confirm server started - ${env.BRANCH} (<${env.BUILD_URL}/console|Details> - <${SERVER_URL}|Open>)"


                    )

But the output is something like this

 [Pipeline] slackSend
 run slackstepsend, step null:false, desc :true
 Slack Send Pipeline step configured values from global config - baseUrl: 
 true, teamDomain: true, token: true, channel: false, color: false

and there is not notification being sent. Any idea?

like image 274
Jenisha Avatar asked Oct 18 '25 11:10

Jenisha


2 Answers

Those values in your pipeline output should be getting populated with the values from your jenkinsfile. eg, teamDomain: true should be teamDomain: <your_slack_team>. You can pass each of these as a parameter in the slacksend invocation in your Jenkinsfile just as you are with channel, color, and message. Also, your channel name doesn't require #, though i don't know if that would cause it to fail.

like image 118
thejames42 Avatar answered Oct 21 '25 03:10

thejames42


slackSend channel: '#yourchannelname', color: color, message: 'Starting branch', teamDomain: 'your_enterprise_team_domain', token: 'token_generated_from_jenkins_slack_integration'

see image for token details

like image 42
salsinga Avatar answered Oct 21 '25 02:10

salsinga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!