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 <[email protected]> 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 <[email protected]> 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 <[email protected]> wrote: >> >>> Thanks for the reply! Any workarounds you can recommend? >>> >>> On Thu, Mar 24, 2016 at 4:47 PM, Slide <[email protected]> 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 <[email protected]> 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 [email protected]. >>>>> 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 [email protected]. >>>> >>> 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 [email protected]. >>> 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 [email protected]. >> > 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 [email protected]. > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVcjkhWYzpfonmvQTdY0FKHu01bOy44J4-zW%3DkWUeXSkYw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
