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

Create easier method to use content tokens in groovy templates

    XMLWordPrintable

Details

    Description

      Currently you have to import all the content token plugins you want to use, create an instance and then call the getContent method to use the email-ext tokens in a groovy template. It would be nice to have an easier method to do this, where you could do something like:

      ENV(var: 'MY_VAR')

      To use the ENV content token.

      Attachments

        Activity

          slide_o_mix Alex Earl created issue -

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java
          src/main/java/hudson/plugins/emailext/ScriptSandbox.java
          src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java
          src/main/java/hudson/plugins/emailext/plugins/EmailTrigger.java
          src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java
          src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/config.groovy
          src/main/resources/hudson/plugins/emailext/templates/email-ext.groovy
          http://jenkins-ci.org/commit/email-ext-plugin/88aa3db61db603ff31acfa6844e15fba200bd5b7
          Log:
          Fix JENKINS-16916

          • Updated ScriptContent to use better groovy setup.
          • In default groovy script, add all content types as closures, these can
            be used like ${ENV(var: "BUILD_ID")} in the groovy template
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java src/main/java/hudson/plugins/emailext/ScriptSandbox.java src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java src/main/java/hudson/plugins/emailext/plugins/EmailTrigger.java src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/config.groovy src/main/resources/hudson/plugins/emailext/templates/email-ext.groovy http://jenkins-ci.org/commit/email-ext-plugin/88aa3db61db603ff31acfa6844e15fba200bd5b7 Log: Fix JENKINS-16916 Updated ScriptContent to use better groovy setup. In default groovy script, add all content types as closures, these can be used like ${ENV(var: "BUILD_ID")} in the groovy template
          slide_o_mix Alex Earl added a comment -

          Added the ability to use the content tokens more easily in groovy templates.

          slide_o_mix Alex Earl added a comment - Added the ability to use the content tokens more easily in groovy templates.
          slide_o_mix Alex Earl made changes -
          Field Original Value New Value
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 147745 ] JNJira + In-Review [ 192563 ]

          People

            slide_o_mix Alex Earl
            slide_o_mix Alex Earl
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: