You don't need to resolve the addresses yourself if you are using a SCRIPT
token, the email-ext plugin will resolve them after it replaces the tokens.
Yes, you can have the $DEFAULT_RECIPIENTS and ${SCRIPT...} tokens in the
edit box and it will work just fine.


On Tue, Mar 11, 2014 at 12:44 PM, Stuart Rowe <[email protected]> wrote:

> I just found the MailAddressResolver class on my own and it's solved the
> problem.
>
> Currently I'm adding recipients by referencing a groovy script directly in
> the project recipients edit box (e.g. ${SCRIPT, script="myscript.groovy"}
> ). The script recursively looks up the requesting userId from the top level
> build and that is used to get a Jenkins User which is passed to
> MailAddressResolver.resolve(). The script returns the address returned by
> resolve().
>
> Is this the best approach? It'd be nice to keep the default recipient and
> append the resolved recipient - can I just put $DEFAULT_RECIPIENT,${SCRIPT,
> script="myscript.groovy"} in the edit box?
>
> Thanks for your help!
>
>
> On Tuesday, 11 March 2014 12:29:10 UTC-7, slide wrote:
>
>> How are you planning, in your groovy script to add the users as
>> recipients? Just a curiosity. You could call the MailAddressResolver
>> resolve method yourself from the groovy script in each recipient, but you
>> may not need to do that depending on how you are adding the recipients.
>> On Mar 11, 2014 11:56 AM, "Stuart Rowe" <[email protected]> wrote:
>>
>>> Sorry for the confusion:
>>>
>>> If a user schedules a single project that has an email post build step
>>> than the email address is resolved automatically by the Active Directory
>>> plugin.
>>>
>>> I'm having problems with a more complicated build pipeline where the
>>> requesting user isn't propagated to a down stream build that has an email
>>> step. I'm attempting to write a groovy script that will set the email
>>> recipients to the requester of the top level build. I've managed to look up
>>> the user ID from the UserIdCause of the top level build, but I haven't
>>> found a way to resolve an email address from that user id.
>>>
>>> I hope that's more clear now :).
>>>
>>>
>>> On Tuesday, 11 March 2014 11:33:47 UTC-7, slide wrote:
>>>>
>>>> You could use the mailmap-resolver-plugin, but I may be missing
>>>> something because there seems to be a discrepancy with what you are saying.
>>>> First you need to look up the user's email address from their user ID, but
>>>> then you say you are getting email addresses from Active Directory? Can you
>>>> clarify.
>>>>
>>>> Thanks,
>>>>
>>>> slide
>>>>
>>>>
>>>> On Tue, Mar 11, 2014 at 11:24 AM, Stuart Rowe <[email protected]>wrote:
>>>>
>>>>> Hi, does anyone know of a way to look up a user's email address from
>>>>> their user ID? I can't make the assumption that the email is "
>>>>> [email protected]" because I know this isn't always the case.
>>>>>
>>>>> We're using the Active Directory plugin for security which is where
>>>>> the email addresses for users are coming from. I need to manually add the
>>>>> requester to the recipient list because this doesn't seem to be propagated
>>>>> by BuildFlow FlowCauses. The relevant parts of build pipeline in this case
>>>>> is:
>>>>>
>>>>> BuildFlow project A (scheduled by the logged in user) --> Build Flow
>>>>> project B --> Free Style Project with an Editable Email Notification post
>>>>> build step.
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Stuart
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Jenkins Users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Website: http://earl-of-code.com
>>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Website: http://earl-of-code.com

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to