KocproZ / jenkins-discord

A post-build plugin that sends the build status to a Discord channel.
MIT License
39 stars 36 forks source link

notifications on state change only #8

Closed andyczerwonka closed 7 years ago

andyczerwonka commented 7 years ago

In order for Discord notifications to not become spam, it's be very useful if we were able to opt-into a state-change-only mode. The following screenshot is from the e-mail notification post-build action, and it does exactly that.

selection_311

The problem with getting notifications on every single build is that you really want to know when it breaks and when it's fixed again. I worry people will ignore the build notification because it just a successful build 99% of the time. Or at least it should be. :-)

jupjohn commented 7 years ago

It has been published as a feature in the latest build. I haven't tested it because I don't have the time nor the resources, but I'm fairly certain it works. The rest (from #6) are being implemented within the next few days. Leaving open until I test it or someone else gets in there before me.

andyczerwonka commented 7 years ago

This doesn't work. I turned on the "Only send on state change" and I get a message on every build. It'd be great if it could be, at the very least, tested lightly.

selection_340

andyczerwonka commented 7 years ago

BTW, "Enable URL linking" seems to work. When I turn it off, I'm getting messages, so that's great. In my branch I used Markdown links in the description given they work. It's only the title that the Discord API rejects.

String url = globalConfig.getUrl() + build.getUrl();
String descriptionPrefix = "**Build:** [#"
                + build.getId()
                + "]("
                + url
                + ")\n**Status:** ["
                + build.getResult().toString().toLowerCase()
                + "]("
                + url
                + ")";
andyczerwonka commented 7 years ago

I've issued a PR with a fix. https://github.com/jammehcow/jenkins-discord/pull/10