jenkinsci / slack-plugin

A Jenkins plugin for posting notifications to a Slack channel
https://plugins.jenkins.io/slack/
MIT License
670 stars 413 forks source link

Notification from unknown user. #693

Open eleksir opened 4 years ago

eleksir commented 4 years ago

Your checklist for this issue

Description

Sometimes slack notifications sends notification from unknown user. Issue is flacky (and really hard to reproduce) and reveals (in my case, because of active development activity) on push event (webhook) from gitlab.

Jenkins 2.222.1 plugin 2.39 os centos-7

Screenshot

jetersen commented 4 years ago

it depends on the git commits and which email is used to commit.

timja commented 4 years ago

I don't believe there's anything we can do here, it depends on APIs provided from elsewhere to get that information.

eleksir commented 4 years ago

But, still you CAN.

Here, what i'm discover: when user being set to Unknown there are these variables set:

BUILD_CAUSE:SCMTRIGGER,MANUALTRIGGER,UPSTREAMTRIGGER, BUILD_CAUSE_MANUALTRIGGER:true, BUILD_CAUSE_SCMTRIGGER:true, BUILD_CAUSE_UPSTREAMTRIGGER:true,

So, if you see that build was caused by manual trigger, you can also check that it caused by scmtrigger and borrow info about user from there is it is not null, ofcorse.

I know that it is looks like jenkins itself bug, but they have terrible reaction speed, so i ask to put this (ugly) workaround on your side.

timja commented 4 years ago

PRs will be accepted for this