jenkinsci / discord-notifier-plugin

A post-build plugin that sends the build status to a Discord channel.
https://plugins.jenkins.io/discord-notifier/
MIT License
50 stars 25 forks source link

Plugin no longer posts notifications #18

Open marth8880 opened 4 years ago

marth8880 commented 4 years ago

This used to work great for me. Now it doesn't work at all.

I recently tried building a project that had this set up working fine last year and now it no longer posts to the Discord channel. The webhook URL hasn't changed nor has anything to do with the build. The plugin is up-to-date.

Jenkins is pretty up-to-date as well. The project is a typical freestyle project using SVN as its SCM. (I'm also not able to get the plugin working with a Bitbucket Server project.)

Maybe I'm missing something?

melt7777 commented 4 years ago

Working fine here as part of Jenkinsfile pipeline: image

Can you provide some more details and example of how you are using it ? Make sure bot has permissions in that Discord channel.

Troubleshooting steps: You could try different job, channel, webhook, etc.

Hope this is helpful!

~ melt miner.farm DevOps Infrastructure Engineer

marth8880 commented 4 years ago

After investigating, notifications are successfully posted with "Enable URL linking" unticked. This is my configuration for the plugin (the only post-build action):

image

And then the rest of the project:

image

image

image

image

"Build" configuration is a series of Windows batch and shell command execution blocks.

It's worth noting I get this message in my build output log when the option is ticked:

Your Jenkins URL is not set (or is set to localhost)!

Which setting is this referring to? Because "Jenkins URL" in the "Configure System" page is definitely set, and not to localhost. Is this the right setting for this?

melt7777 commented 4 years ago

I am using Discord Notifier Plugin 1.4.12 over Jenkins 2.222.3 (Both are the current latest available in repos)

I successfully tested both my Jenkinsfile Pipeline via SCM discord notifications, and my freestyle projects discord notifications, with both URL linking ON and OFF, and all 4 variations are working properly for me.

For localhost error, have a quick peek at this page: https://www.tutorialspoint.com/jenkins/jenkins_configuration.htm

Triage tip: Perhaps add debug lines prior to discord notification step, Execute shell echo ${JENKINS_URL} and such, to see what's going on.

Hope this is helpful!

~ melt miner.farm DevOps Infrastructure Engineer

marth8880 commented 4 years ago

Jenkins URL is echoing the correct value:

image

Our Jenkins instance is set up for URL redirection with nginx, could that be related?

melt7777 commented 4 years ago

So, I found where that error comes from. When URL Linking is turned on, then it will check for the global url, i'm guessing this is the value of "Jenkins Location -> Jenkins URL" on /configure. Should not matter if it's proxied.

Here's the code:

https://github.com/jenkinsci/discord-notifier-plugin/blob/f92330012c61e5989bccbcb87da3b3a3c794c9cf/src/main/java/nz/co/jammehcow/jenkinsdiscord/WebhookPublisher.java#L192

Hope this helps, all!

~ melt miner.farm DevOps