kuleuven / jenkins-mattermost-plugin

Jenkins plugin for Mattermost
MIT License
24 stars 46 forks source link

Only seeing Notify Build Start Notification #7

Closed garethgreenaway closed 8 years ago

garethgreenaway commented 8 years ago

Using 1.638 and Mattermost 2.1, I'm only seeing notifications for when builds start. No other notifications appear to be sent.

jovandeginste commented 8 years ago

I'm running Jenkins 1.655 and Mattermost 2.1. Are you running version 1.5.0 of this plugin?

Can you see what's in jenkins.log? For each post, I have lines like these:

INFO: Posting: to #$room icon: $url, on $hook: $message
INFO: Posting succeeded

Do you see any lines for other than the build start?

jovandeginste commented 8 years ago

(or 1.5.1)

garethgreenaway commented 8 years ago

I ended up building it manually so the version is 1.5.2-SNAPSHOT (private-108f394f-gareth), I'll try installing 1.5.1 and see if that works.

jovandeginste commented 8 years ago

OK please keep me posted here!

garethgreenaway commented 8 years ago

An update. I had to upgrade the problematic version of Jenkins to the latest version, then I was able to install the Mattermost plugin (1.5.1). Unfortunately seeing the same results as before. However, I spun up a fresh install of Jenkins with the plugin and I do see the correct output when running a build job. So something is wonky on this other setup, unrelated to the plugin.

Another update Tried a different job and I saw everything. So something wonky in this particular job.

jovandeginste commented 8 years ago

Perhaps a combination with another plugin? Is it possible for you to verify this? Could you test your job (or a copy of it) in the "broken" set-up with steps other than mattermost publisher removed? If this should work, try out combinations of steps until it stops working, etc.

garethgreenaway commented 8 years ago

The only other plugin that is being used by this particular build job is the Virtualenv plugin. For the status of the job, how does the Mattermost plugin determine which status to send? Maybe the status this particular job is invalid and so it doesn't know which one to send?

jovandeginste commented 8 years ago

I think these are the most relevant lines:

https://github.com/jovandeginste/jenkins-mattermost-plugin/blob/master/src/main/java/jenkins/plugins/mattermost/ActiveNotifier.java#L224

Also but less relevant:

https://github.com/jovandeginste/jenkins-mattermost-plugin/blob/master/src/main/java/jenkins/plugins/mattermost/ActiveNotifier.java#L97

garethgreenaway commented 8 years ago

Cleared all the build steps out to try and get some notifications working via Mattermost, when I took a look at the logs I see this error:

WARNING: RunListener failed java.lang.NoClassDefFoundError: hudson/tasks/test/AbstractTestResultAction at jenkins.plugins.mattermost.ActiveNotifier$MessageBuilder.appendTestSummary(ActiveNotifier.java:286) at jenkins.plugins.mattermost.ActiveNotifier.getBuildStatusMessage(ActiveNotifier.java:198) at jenkins.plugins.mattermost.ActiveNotifier.completed(ActiveNotifier.java:105) at jenkins.plugins.mattermost.MattermostListener.onCompleted(MattermostListener.java:27) at jenkins.plugins.mattermost.MattermostListener.onCompleted(MattermostListener.java:15) at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:202) at hudson.model.Run.execute(Run.java:1783) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410)

jovandeginste commented 8 years ago

Did you install any plugins in your fresh install? Can you replicate the broken job in your wonky setup? I'm by no means an expert...

garethgreenaway commented 8 years ago

I installed a lot of plugins in the new install where it's working there are also a number of them installed in the older setup where it's not working. I created a new job, copying the old job and it has the same results. I'm wondering if there is something outdated being referenced in the old jobs that is causing the issue. Need to investigate more.

garethgreenaway commented 8 years ago

Found the cause! Someone at some point at disabled the JUnit plugin on the older jenkins setup. For whatever reason, someone about this particular job needed that to send the results along. Once I re-enabled it and restarted Jenkins everything started working again. Closing this out. Thanks!

jovandeginste commented 8 years ago

Great you found this! I'm not sure why junit should be necessary, maybe I can add a test for it in the code...

garethgreenaway commented 8 years ago

Looking at what options I had enabled it looks like this one was selected in the job that was having issues: "Include Test Summary" but not in the one that was working. Could be the cause.

jovandeginste commented 8 years ago

It was checked in the mattermost settings?

garethgreenaway commented 8 years ago

The Mattermost Jenkins settings, in Advanced. I hadn't noticed that I was checked it until just now.

jovandeginste commented 8 years ago

Ok still something to test for then! Can't have stack traces now, can we ;-)

garethgreenaway commented 8 years ago

:+1: