Scenario:
I have jobs with Jenkinsfiles where I can get the env.BUILD_USER_ID
exposed by a Jenkins plugin. So, what I`m planning to do is associating this variable content to the Slack user ID value, like in a dictionary or list (or whatever).
e.g. johndoe@domain.com(env.BUILD_USER_ID
) : 4555FDDGH
(slack user)
and then, creating a condition at Jenkinsfile to evaluate if the env.BUILD_USER_ID
value matches ANY of the slack users within the dictionary. With that info, I can mention the person who triggered a failing build, on a slack channel.
I was also thinking about storing this dictionary outside the jenkinsfile (maybe a JSON file on a different repo)
What are your sugestions on validating the env.BUILD_USER_ID
along with the slack user, plus where it`s doable to store this info. I think having it at the Jenkinsfile it self is not secure and a bit sketchy to be honest.