getEnvironment(listener) worked!!

Regarding buildVariables, this code:
logger.println("Build Variables Start: ")
  build.each {
    logger.println(it)
  }
  logger.println("Build Variables End")

Produced:

Build Variables Start:
deploy-sidecar-gold-gmatz-test #20
Build Variables End


Thanks again!!


On Fri, Mar 25, 2016 at 11:44 AM, Slide <slide.o....@gmail.com> wrote:

> Can you print out what is in build.buildVariables? The other thing to try
> would be build.getEnvironment(listener)['JIRA_USERNAME']
>
> On Fri, Mar 25, 2016 at 8:39 AM Guy Matz <guym...@gmail.com> wrote:
>
>> Hmm . . .  no, the build.buildVariables['JIRA_USERNAME'] showed up as
>> null . . .  any other thoughts?
>>
>> Thanks again,
>> Guy
>>
>> P.S. - Thanks for the pointer to the Jira plugin.  That might work for
>> another problem I have!
>>
>> On Fri, Mar 25, 2016 at 10:24 AM, Slide <slide.o....@gmail.com> wrote:
>>
>>> Can you try using build.buildVariables['JIRA_USERNAME']? Also, there are
>>> a couple of JIRA plugins that might do what you want.
>>>
>>> https://wiki.jenkins-ci.org/display/JENKINS/JIRA+Plugin
>>>
>>> https://wiki.jenkins-ci.org/display/JENKINS/Jira+Issue+Updater+Plugin
>>>
>>> On Fri, Mar 25, 2016 at 6:37 AM Guy Matz <guym...@gmail.com> wrote:
>>>
>>>> Thanks, yes the credentials are supposed to be in the environment!  My
>>>> presend script is creating a Jira ticket via REST API, so I have my jira
>>>> user's username & password in credentials, and am defining them as
>>>> JIRA_USERNAME & JIRA_PASSWORD, respectively.  I am then referencing them in
>>>> the pre-send like so:
>>>>
>>>> def createJiraTicket(String changelog) {
>>>>
>>>>   jiraProject = 'Change Management System'
>>>>   jiraProjectCode = 'CMS'
>>>>   jiraUser = System.env['JIRA_USERNAME']
>>>>   jiraPassword = System.env['JIRA_PASSWORD']
>>>>   logger.println("Accessing Jira with user ${jiraUser}")  // jiraUser
>>>> shows up as null
>>>>   //  This loop has been added for debugging.  Many other ENV vars are
>>>> logged here,
>>>>   //  but not JIRA_USERNAME & JIRA_PASSWORD
>>>>   System.env.sort().each {
>>>>     logger.println(it)
>>>>   }
>>>>   .
>>>>   .
>>>>   .
>>>>
>>>> I *am* able to use $JIRA_USERNAME & $JIRA_PASSWORD in a build step . . .
>>>>
>>>> Any thoughts here would be greatly appreciated!!
>>>>
>>>> Thanks a lot,
>>>> Guy
>>>>
>>>>
>>>> On Thu, Mar 24, 2016 at 6:10 PM, Slide <slide.o....@gmail.com> wrote:
>>>>
>>>>> How are you specifying the credentials? I am not completely familiar
>>>>> with the credentials plugin, so I don't know how it makes things available
>>>>> to a job. If it does it via the environment, then they should be available
>>>>> in the pre-send script. Can you post your pre-send script and job config?
>>>>>
>>>>> On Thu, Mar 24, 2016 at 2:02 PM Guy Matz <guym...@gmail.com> wrote:
>>>>>
>>>>>> Thanks for the reply!  Any workarounds you can recommend?
>>>>>>
>>>>>> On Thu, Mar 24, 2016 at 4:47 PM, Slide <slide.o....@gmail.com> wrote:
>>>>>>
>>>>>>> Email-ext doesn't have any direct support for the credentials
>>>>>>> plugin. I am looking at adding it for the SMTP credentials, but not
>>>>>>> specifically for what you are describing.
>>>>>>>
>>>>>>> On Thu, Mar 24, 2016, 13:40 Guy Matz <guym...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hello!  I'm trying to pass some credentials (via the credentials
>>>>>>>> plugin) to a pre-send script within the email-ext plugin . . .  
>>>>>>>> however,
>>>>>>>> the credentials are not showing up as environment vars . . .  anyone 
>>>>>>>> know
>>>>>>>> how if these two plugins can work together?
>>>>>>>>
>>>>>>>> Thanks a lot!
>>>>>>>> Guy
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>>>>>>>> To view this discussion on the web visit
>>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtXpLxev4G-sjtJa4i_mLgH%3DJf60GBN0EUzjGR-nkc1tQw%40mail.gmail.com
>>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtXpLxev4G-sjtJa4i_mLgH%3DJf60GBN0EUzjGR-nkc1tQw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>>>>>>>
>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfMN-iBmyoJowNk4iEBs_q8%2BL3TKkOVPqOmfxJLBHrCTQ%40mail.gmail.com
>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfMN-iBmyoJowNk4iEBs_q8%2BL3TKkOVPqOmfxJLBHrCTQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>
>>>>>>
>>>>>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtVoDepGqVZxQaP-X9CEVU9MgfS54Dcz5YPwhra5jcfeiA%40mail.gmail.com
>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtVoDepGqVZxQaP-X9CEVU9MgfS54Dcz5YPwhra5jcfeiA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>>>>>
>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeugVLQUv8aA6C7WEn0_o_0OF%3D6j0zB%2B5sGRzj5Ss6GhA%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeugVLQUv8aA6C7WEn0_o_0OF%3D6j0zB%2B5sGRzj5Ss6GhA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>
>>>>
>>>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtV8Xxk7Q0x9fPYGK3jx_iiu6B7yh%2BEQ49PJjHTzKOF3aA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtV8Xxk7Q0x9fPYGK3jx_iiu6B7yh%2BEQ49PJjHTzKOF3aA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcjkhWYzpfonmvQTdY0FKHu01bOy44J4-zW%3DkWUeXSkYw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcjkhWYzpfonmvQTdY0FKHu01bOy44J4-zW%3DkWUeXSkYw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>
>>
>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtX5kO-aeNdVBLLugn1rfyEPMMv7La4U4%2BUHgzmCTrOS8A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtX5kO-aeNdVBLLugn1rfyEPMMv7La4U4%2BUHgzmCTrOS8A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeBqYSbn%3DtiYDDKDLGWy15MtRssj2%2BZC9ZtydNMFNz6zA%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVeBqYSbn%3DtiYDDKDLGWy15MtRssj2%2BZC9ZtydNMFNz6zA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CABnTgtWb8KkXAOsx-HEZjCBtvetOG_%3DXa78zEycN4pMkOu%3D4Cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to