Open TomTucka opened 4 years ago
Use slackUserIdFromEmail
it will lookup the user's profile in Jenkins and use the slack API if it's not set there. Or whatever strategy you use. Some places store it in their directory information and have custom plugins to look it up.
I'm not sure that the slackUserIdFromEmail
step looks at the user's profile in Jenkins, I think it does a straight lookup via the slack API. If I'm reading the code correctly, it seems that profile setting is only used when notifying ChangeSet authors, which I don't have for my jobs.
I would like to send a slack notification to the user that manually started the build, based on this profile setting. Has anyone had luck with this?
Thanks!
Update in case it's useful for anyone--I'm able to access the user property directly from a pipeline library function (in conjunction with the Build User Vars plugin):
wrap([$class: 'BuildUser']) {
def user = User.getById(env.BUILD_USER_ID, false)
def slackUserProperty = user?.getProperty(jenkins.plugins.slack.user.SlackUserProperty.class)
def userId = slackUserProperty?.getUserId()
}
@pitaylor @timja can we add this logic as default one directly on slackUserIdFromEmail
class?
Your checklist for this issue
[2.235.4] Jenkins version
[2.40] Plugin version
Description
Hi,
If there any way to get the slack user ID from someone's Jenkins profile? I'd like to personal message people using the bot when specific things happen in certain builds
Cheers