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

No matrix trigger mode in extendedEmail in multi configuration - Jenkins DSL

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • job-dsl-plugin
    • Jenkins(ver. 2.222.1)
      Jenkins DSL plugin((v1.77)
      extendedEmail plugin(v2.69)

      We use multi configuration project on Jenkins(ver. 2.222.1) We use JenkinsDSL(v1.77) to create the free-style jobs from the groovy scripts. Email notifications is with extendedEmail(v2.69)
      It seems like trigger mode for notifications cannot be specified in the groovy script but it could be done via the UI as below(ONLY_PARENT or ONLY_CONFIGURATIONS or BOTH

      As I see we could specify for extendedEmail in groovy for DSL plugin as below

       

      job('example') {
          publishers {
              extendedEmail {
                  recipientList('me@halfempty.org')
                  defaultSubject('Oops')
                  defaultContent('Something broken')
                  contentType('text/html')
                  triggers {
                      beforeBuild()
                      stillUnstable {
                          subject('Subject')
                          content('Body')
                          sendTo {
                              developers()
                              requester()
                              culprits()
                          }
                      }
                  }
              }
          }
      }

      I was wondering if we had something similar to hipChatNotifier as below ( matrixTriggerMode('ONLY_PARENT'))

       

      job('example') {
        publishers {
          hipChatNotifier {
            room('Dev Team A, QA')
            matrixTriggerMode('ONLY_PARENT')
            startJobMessage(null)
            completeJobMessage(null)
            token(null)
            notifications {
              notificationConfig {
                notifyEnabled(true)
                textFormat(true)
                notificationType('ABORTED')
                color('GRAY')
                messageTemplate(null)
              }

      How do I achieve it for extendedEmail? As I could do the same via the UI 

       

          [JENKINS-64574] No matrix trigger mode in extendedEmail in multi configuration - Jenkins DSL

          Jim Searle added a comment -

          The doc: 
          https://myjenkins/plugin/job-dsl/api-viewer/index.html#method/javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.extendedEmailPublisher
           
          Shows:

          // Specifies when to trigger a downstream build for matrix jobs: ONLY_PARENT: trigger only once when parent finishes ONLY_CONFIGURATIONS: trigger for each configuration BOTH: combination of the 2 above options Note: that downstream jobs will only be triggered, if they are not already in the build queue.
          matrixTriggerMode(String value)
          

          But errors out if you try to use it:

          ERROR: (myjob.dsl, line 68) No signature of method: javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.matrixTriggerMode() is applicable for argument types: (java.lang.String) values: [ONLY_PARENT]
          

          So I had to add the configure as mentioned here: https://stackoverflow.com/questions/65626829/matrix-trigger-mode-in-extendedemail-jenkins-job-dsl

           

          Jim Searle added a comment - The doc:  https://myjenkins/plugin/job-dsl/api-viewer/index.html#method/javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.extendedEmailPublisher   Shows: // Specifies when to trigger a downstream build for matrix jobs: ONLY_PARENT: trigger only once when parent finishes ONLY_CONFIGURATIONS: trigger for each configuration BOTH: combination of the 2 above options Note: that downstream jobs will only be triggered, if they are not already in the build queue. matrixTriggerMode(String value) But errors out if you try to use it: ERROR: (myjob.dsl, line 68) No signature of method: javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.matrixTriggerMode() is applicable for argument types: (java.lang.String) values: [ONLY_PARENT] So I had to add the configure as mentioned here: https://stackoverflow.com/questions/65626829/matrix-trigger-mode-in-extendedemail-jenkins-job-dsl  

            jamietanna Jamie Tanna
            anudeepmk Anudeep
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: