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

Allow programatic change of recipients

    Details

    • Similar Issues:

      Description

      We are usign Jenkins in our Corp Environment for several project teams. Currently we are doing up to 200 builds per day and we organize our teams within LDAP groups (also for accessing several repositories in svn).

      Now I would like to send the mails from email-ext to the whole svn group. I started writing my own plugin for reading mail-addresses from LDAP but struggled how to change the configured recipients from the plugin.

      After reading the documentation It seems that there is no standard way in overwriting the project recipients like for subjects and so on.

      This issue is ment as help request. If there is no such feature, I am willing to contribute this. But before altering code I would be sure that I didnt miss an allready existing feature within the plugin.

        Attachments

          Activity

          Hide
          fmueller Frank Mueller added a comment -

          That is the point. Currently I dont do it because I cannot. I have several options to evaluate:

          1. Make a environment variable for each job (I dont want to do this because the amount of jobs we have)
          2. Write an textfile and import it via the groovy-script function
          3. Integrate this function directly into email-ext (either by a fork or contribution)

          This ticket is for evaluate if there is a chance to have some sort of build related environment variable (not system wide) that can be used in the subject field within email-ext. I am currently not so deep into jenkins plugin development to know how to archive this but i know there must be build related environment variables like $WORKSPACE and so on.

          Show
          fmueller Frank Mueller added a comment - That is the point. Currently I dont do it because I cannot. I have several options to evaluate: 1. Make a environment variable for each job (I dont want to do this because the amount of jobs we have) 2. Write an textfile and import it via the groovy-script function 3. Integrate this function directly into email-ext (either by a fork or contribution) This ticket is for evaluate if there is a chance to have some sort of build related environment variable (not system wide) that can be used in the subject field within email-ext. I am currently not so deep into jenkins plugin development to know how to archive this but i know there must be build related environment variables like $WORKSPACE and so on.
          Hide
          gcummings Geoff Cummings added a comment -

          I think Alex meant to define the variable and its value in the job configuration, not as a global environment variable.

          Show
          gcummings Geoff Cummings added a comment - I think Alex meant to define the variable and its value in the job configuration, not as a global environment variable.
          Hide
          slide_o_mix Alex Earl added a comment -

          Yes, I did mean each project would have a parameter (parameterized with default value) or environment variable (injected via EnvInject or something), not a system wide one.

          Show
          slide_o_mix Alex Earl added a comment - Yes, I did mean each project would have a parameter (parameterized with default value) or environment variable (injected via EnvInject or something), not a system wide one.
          Hide
          gcummings Geoff Cummings added a comment -

          For example the following plugin:
          https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin

          Using this you can enable "Prepare an environment for the run" in the job configuration.
          This will allow you to add environment variables for use in the build.

          You could then enter a property for job1 LDAP_GROUP=group1
          and for job2 you could have LDAP_GROUP=group2

          You could optionally define a global environment property LDAP_GROUP=defaultGroup which would be used by default unless the job specified the property as specified above.

          Now that you have an environment variable available which contains the LDAP group to lookup, you can reference that from your groovy code?

          Show
          gcummings Geoff Cummings added a comment - For example the following plugin: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin Using this you can enable "Prepare an environment for the run" in the job configuration. This will allow you to add environment variables for use in the build. You could then enter a property for job1 LDAP_GROUP=group1 and for job2 you could have LDAP_GROUP=group2 You could optionally define a global environment property LDAP_GROUP=defaultGroup which would be used by default unless the job specified the property as specified above. Now that you have an environment variable available which contains the LDAP group to lookup, you can reference that from your groovy code?
          Hide
          slide_o_mix Alex Earl added a comment -

          I think this can easily be achieved with parameterized jobs with default values and either a pre-send script, or Groovy script which uses the parameter for the ldap group.

          Show
          slide_o_mix Alex Earl added a comment - I think this can easily be achieved with parameterized jobs with default values and either a pre-send script, or Groovy script which uses the parameter for the ldap group.

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              fmueller Frank Mueller
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: