Get jenkinsintance from current context, to avoid script approval

nginx_conf
Nicolas Arenas 2024-10-01 20:02:44 +02:00
parent 6fb97ba4a4
commit a9df18a987
1 changed files with 1 additions and 1 deletions

View File

@ -112,7 +112,7 @@ pipeline {
@NonCPS
def getUserEmail(userId) {
def jenkinsInstance = jenkins.model.Jenkins.getInstanceOrNull()
def jenkinsInstance = currentBuild.rawBuild.getParent().getParent()
if (jenkinsInstance != null) {
def user = jenkinsInstance.getUser(userId)
return user.getProperty(jenkins.plugins.mailer.tasks.Mailer.UserProperty)?.getAddress()