Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28421

Information provided to email-ext should be perforce email address, not perforce username

    Details

    • Similar Issues:

      Description

      When a username is provided to the email-ext plugin the perforce username is provided. It would be better to return the configured perforce email address for that username if it is configured.

        Attachments

          Activity

          treale Thomas Reale created issue -
          sumdumgai A C made changes -
          Field Original Value New Value
          Priority Minor [ 4 ] Major [ 3 ]
          Hide
          sumdumgai A C added a comment -

          Upping to Major, as this prevents an important part of continuous integration workflow, namely directly identifying and emailing developers the results of their checkins.

          Show
          sumdumgai A C added a comment - Upping to Major, as this prevents an important part of continuous integration workflow, namely directly identifying and emailing developers the results of their checkins.
          sumdumgai A C made changes -
          Assignee Paul Allen [ p4paul ]
          Hide
          danielbeck Daniel Beck added a comment -

          In general, mapping from user names to email addresses is the job of plugins implementing MailAddressResolver in Jenkins. It should be pretty automatic if your SCM user names are the same as your Jenkins user names and you're using e.g. LDAP, otherwise, a different implementation may be needed. Still, not really necessary to change the user names returned by P4.

          https://wiki.jenkins-ci.org/display/JENKINS/Additional+Identities+Plugin may work for you. It associates additional identities (e.g. p4 user names) to Jenkins user records, and through those, to their email addresses.

          Show
          danielbeck Daniel Beck added a comment - In general, mapping from user names to email addresses is the job of plugins implementing MailAddressResolver in Jenkins. It should be pretty automatic if your SCM user names are the same as your Jenkins user names and you're using e.g. LDAP, otherwise, a different implementation may be needed. Still, not really necessary to change the user names returned by P4. https://wiki.jenkins-ci.org/display/JENKINS/Additional+Identities+Plugin may work for you. It associates additional identities (e.g. p4 user names) to Jenkins user records, and through those, to their email addresses.
          Hide
          sumdumgai A C added a comment -

          I am in an environment where I do require the email address to come directly from the Perforce account info, it's the only available data source.

          The email address cannot be inferred from the Perforce username, Perforce users do not necessarily have accounts on the Jenkins server (nor do I want them to if at all possible), nor are all users in LDAP (or any other accessible directory) - using Additional Identities as a workaround would be a real pain.

          Show
          sumdumgai A C added a comment - I am in an environment where I do require the email address to come directly from the Perforce account info, it's the only available data source. The email address cannot be inferred from the Perforce username, Perforce users do not necessarily have accounts on the Jenkins server (nor do I want them to if at all possible), nor are all users in LDAP (or any other accessible directory) - using Additional Identities as a workaround would be a real pain.
          Hide
          p4paul Paul Allen added a comment -

          The email address is easily accessible from the 'user' spec in Perforce. I just need to know how to make it available to the email-ext plugin.

          Show
          p4paul Paul Allen added a comment - The email address is easily accessible from the 'user' spec in Perforce. I just need to know how to make it available to the email-ext plugin.
          Hide
          danielbeck Daniel Beck added a comment -

          Create an Extension implementing MailAddressResolver from the mailer plugin. This can be an optional dependency to the mailer plugin, with your implementation annotated Extension(optional=true). If the mailer plugin exists and is enabled, p4 will provide the feature, otherwise it won't.

          Show
          danielbeck Daniel Beck added a comment - Create an Extension implementing MailAddressResolver from the mailer plugin. This can be an optional dependency to the mailer plugin, with your implementation annotated Extension(optional=true) . If the mailer plugin exists and is enabled, p4 will provide the feature, otherwise it won't.
          Hide
          jedavis Jason Davis added a comment -

          I'm also in the same boat as A C and kind of a deal breaker for the plugin at the moment (don't get me wrong, the plugin is coming along real well). Collecting the email addresses from Perforce appears to be a feature of the other Perforce plugin in case that helps.

          Show
          jedavis Jason Davis added a comment - I'm also in the same boat as A C and kind of a deal breaker for the plugin at the moment (don't get me wrong, the plugin is coming along real well). Collecting the email addresses from Perforce appears to be a feature of the other Perforce plugin in case that helps.
          Hide
          p4paul Paul Allen added a comment - - edited

          I'm curious if I can set hudson.tasks.Mailer.UserProperty.UserProperty. MailAddressResolver claims to look for the email as a UserProperty:

          So the common technique for a mail address resolution is to define your own {@link UserProperty} types and
          add it to {@link User} objects where more context is available. For example, an {@link SCM} implementation
          can have a lot more information about a particular user during a check out, so that would be a good place
          to capture information as {@link UserProperty}, which then later used by a {@link MailAddressResolver}.
          
          Show
          p4paul Paul Allen added a comment - - edited I'm curious if I can set hudson.tasks.Mailer.UserProperty.UserProperty. MailAddressResolver claims to look for the email as a UserProperty: So the common technique for a mail address resolution is to define your own {@link UserProperty} types and add it to {@link User} objects where more context is available. For example, an {@link SCM} implementation can have a lot more information about a particular user during a check out, so that would be a good place to capture information as {@link UserProperty}, which then later used by a {@link MailAddressResolver}.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java
          src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java
          http://jenkins-ci.org/commit/p4-plugin/5f936ad0fffc3212a1960b1d7c67c3807c657fe4
          Log:
          Add Perforce User's email to Jenkins User property.

          JENKINS-28421

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java http://jenkins-ci.org/commit/p4-plugin/5f936ad0fffc3212a1960b1d7c67c3807c657fe4 Log: Add Perforce User's email to Jenkins User property. JENKINS-28421
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java
          http://jenkins-ci.org/commit/p4-plugin/e117cd2c9d1a33745191f5c326d4efb0184ace85
          Log:
          Only set email if User's address in null or empty.

          JENKINS-28421

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java http://jenkins-ci.org/commit/p4-plugin/e117cd2c9d1a33745191f5c326d4efb0184ace85 Log: Only set email if User's address in null or empty. JENKINS-28421
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java
          src/main/java/org/jenkinsci/plugins/p4/email/P4AddressResolver.java
          src/main/java/org/jenkinsci/plugins/p4/email/P4UserProperty.java
          src/main/resources/org/jenkinsci/plugins/p4/email/P4UserProperty/config.jelly
          http://jenkins-ci.org/commit/p4-plugin/c1f15ea19c720a3d4840aafa478b177c0d0f8f97
          Log:
          Created P4UserProperty to store Email address.

          P4UserProperty extends UserProperty to store the Perforce User’s email.
          Then retrieves it with P4AddressResolver by extending
          MailAddressResolver.

          JENKINS-28421

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java src/main/java/org/jenkinsci/plugins/p4/email/P4AddressResolver.java src/main/java/org/jenkinsci/plugins/p4/email/P4UserProperty.java src/main/resources/org/jenkinsci/plugins/p4/email/P4UserProperty/config.jelly http://jenkins-ci.org/commit/p4-plugin/c1f15ea19c720a3d4840aafa478b177c0d0f8f97 Log: Created P4UserProperty to store Email address. P4UserProperty extends UserProperty to store the Perforce User’s email. Then retrieves it with P4AddressResolver by extending MailAddressResolver. JENKINS-28421
          Hide
          p4paul Paul Allen added a comment -

          Fixed 1.3.0

          Show
          p4paul Paul Allen added a comment - Fixed 1.3.0
          p4paul Paul Allen made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 163261 ] JNJira + In-Review [ 208781 ]

            People

            • Assignee:
              p4paul Paul Allen
              Reporter:
              treale Thomas Reale
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: