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

EMAIL-EXT - FILE token doesn't allow NESTED contents.

      Hi

      Please see and read the following link to get info on the description and request:

      **********
      To enhance EMAIL-EXT plugin to the next level as it doesn't support Nested content at this time.
      **********

      (LINK):
      http://jenkins.361315.n4.nabble.com/Configure-email-in-Jenkins-using-a-local-file-td4631396.html

      Regards
      Arun Sangal
      arun_sangal@yahoo.com

          [JENKINS-14210] EMAIL-EXT - FILE token doesn't allow NESTED contents.

          Alex Earl added a comment -

          fyi, the FILE content token can only take a file from the workspace, not any file on the file system. This will likely not change, so I don't think you can do what you want even if this is changed. I would recommend just using different templates and editing those files as necessary.

          Alex Earl added a comment - fyi, the FILE content token can only take a file from the workspace, not any file on the file system. This will likely not change, so I don't think you can do what you want even if this is changed. I would recommend just using different templates and editing those files as necessary.

          Arun Sangal added a comment - - edited

          I agree.

          But, In my case, the file sits at the workspace (file system location) and Jenkins is working fine except for the fact that it's not expanding ${JELLY_SCRIPT...} further. I'm planning to version this file (giga.txt) as well therefore, if we get this nested thing done, then, we'll serve / meet Jenkins guidelines and our nested requirement will meet as well.

          Arun Sangal added a comment - - edited I agree. But, In my case, the file sits at the workspace (file system location) and Jenkins is working fine except for the fact that it's not expanding ${JELLY_SCRIPT...} further. I'm planning to version this file (giga.txt) as well therefore, if we get this nested thing done, then, we'll serve / meet Jenkins guidelines and our nested requirement will meet as well.

          Code changed in jenkins
          User: slide
          Path:
          src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent.java
          http://jenkins-ci.org/commit/email-ext-plugin/91eb95e11cba45b967b5cdee55573aaf35de98c8
          Log:
          Fix JENKINS-14210

          Allow nested content in a JELLY_SCRIPT

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: slide Path: src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent.java http://jenkins-ci.org/commit/email-ext-plugin/91eb95e11cba45b967b5cdee55573aaf35de98c8 Log: Fix JENKINS-14210 Allow nested content in a JELLY_SCRIPT

          Code changed in jenkins
          User: slide
          Path:
          src/main/java/hudson/plugins/emailext/plugins/content/WorkspaceFileContent.java
          http://jenkins-ci.org/commit/email-ext-plugin/594b9c750859c695c3e27c768b5bcd39ac76e3a5
          Log:
          Fix JENKINS-14210

          Allow nested content in a JELLY_SCRIPT

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: slide Path: src/main/java/hudson/plugins/emailext/plugins/content/WorkspaceFileContent.java http://jenkins-ci.org/commit/email-ext-plugin/594b9c750859c695c3e27c768b5bcd39ac76e3a5 Log: Fix JENKINS-14210 Allow nested content in a JELLY_SCRIPT

          Arun Sangal added a comment - - edited

          Thanks a lot Slide.

          Now, similar to this same request. I opened a new request to get similar funcationality.

          PS (LINK): https://issues.jenkins-ci.org/browse/JENKINS-14299

          In the Editable email notification (Email-ext plugin), we have Subject, Recepients etc fields.

          What I was wondering is if I can defined those in all of my Jenkins jobs as one variable like: $RECEPIENTS, $SUBJECT etc. Now, what I'll do is, I'll set these variables from a file that I'll use as a environment variable property file. i.e.

          If I give C:\giga\email.config.<jobname>.<instancename>.txt as the environment file withing Jenkins JOB, then, inside this file, I'll set the variables for EMAIL variables like:

          RECEPIENTS=abc@xyz.com, giga@fifa.com
          SUBJECT=[$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # $BUILD_NUMBER
          or
          SUBJECT=[$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # ${ENV,var="build.label"}

          NOW, seems like when I tried using this behaviour, I found that an environment variable IF containing another variable are NOT EXPANDING as well. Is there any way, we can achieve this too.

          Now, your question towards me would be:
          1. Why dont I use the above variables in the Jenkins job directly and remain silent / happy ???

          Actually to answer it: I see the following conclusions:
          1. As I have many Jenkins job, I want all the jobs to reflect MINIMAL configuration at the Jenkins setting i.e. if Email Ext "SUBJECT" box contains: $SUBJECT
          only, then, it'll lot easier for the new user to understand and learn.
          2. All the jobs will be SAME as far as EMAIL-EXT (Editable email notification) section is concerned. SAME in the sense of using the environment variables.
          3. Definition of these environment variables DONT have to be defined at the Jenkins job level as we will create a config file and define the variables there and just use one variable name per box (for each Editable email notification fields/boxes).
          4. If someday we need to change the subject,
          FROM:

          SUBJECT=[$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # $BUILD_NUMBER
          -to->
          SUBJECT=[$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # ${ENV,var="build.label"}
          or -to->
          SUBJECT=Jenkins Build $BUILD_STATUS: $PROJECT_NAME # ${ENV,var="version.label"}

          I dont have to go in Jenkins job configuration and change it there. I'll just change my config file and there you'll see the change in the email notification as Jenkins job's EMAIL SUBJECT box is stil containing $SUBJECT variable which's defined in our config file.

          5. BASICALLY, what we need in the above request is...
          similarly like you allowed nested contents in the JELLY script (EMAIL CONTENT area),
          can we have the same "nested" capability in other parts of the JENKINS jobs where we specify some variables (it can be Email's fields/boxes, or it can be any field/box in Jenkins job's whole configuraiton).

          What we want to achieve here is (30000 feet view):

          if X=$Y and if Y=${VAR}-I_like_it and VAR=FIFA.
          Then X should result as:
          "FIFA-I_like_it"

          Apart from that, when can we expect the nested funcationality of Jelly to be included in the next version of Jenkins build .war? Kindly advise.

          Thanks.
          Regards
          Arun Sangal

          Arun Sangal added a comment - - edited Thanks a lot Slide. Now, similar to this same request. I opened a new request to get similar funcationality. PS (LINK): https://issues.jenkins-ci.org/browse/JENKINS-14299 In the Editable email notification (Email-ext plugin), we have Subject, Recepients etc fields. What I was wondering is if I can defined those in all of my Jenkins jobs as one variable like: $RECEPIENTS, $SUBJECT etc. Now, what I'll do is, I'll set these variables from a file that I'll use as a environment variable property file. i.e. If I give C:\giga\email.config.<jobname>.<instancename>.txt as the environment file withing Jenkins JOB, then, inside this file, I'll set the variables for EMAIL variables like: RECEPIENTS=abc@xyz.com, giga@fifa.com SUBJECT= [$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # $BUILD_NUMBER or SUBJECT= [$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # ${ENV,var="build.label"} NOW, seems like when I tried using this behaviour, I found that an environment variable IF containing another variable are NOT EXPANDING as well. Is there any way, we can achieve this too. Now, your question towards me would be: 1. Why dont I use the above variables in the Jenkins job directly and remain silent / happy ??? Actually to answer it: I see the following conclusions: 1. As I have many Jenkins job, I want all the jobs to reflect MINIMAL configuration at the Jenkins setting i.e. if Email Ext "SUBJECT" box contains: $SUBJECT only, then, it'll lot easier for the new user to understand and learn. 2. All the jobs will be SAME as far as EMAIL-EXT (Editable email notification) section is concerned. SAME in the sense of using the environment variables. 3. Definition of these environment variables DONT have to be defined at the Jenkins job level as we will create a config file and define the variables there and just use one variable name per box (for each Editable email notification fields/boxes). 4. If someday we need to change the subject, FROM: SUBJECT= [$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # $BUILD_NUMBER - to -> SUBJECT= [$INSTANCE_NAME] Build $BUILD_STATUS: $PROJECT_NAME # ${ENV,var="build.label"} or - to -> SUBJECT=Jenkins Build $BUILD_STATUS: $PROJECT_NAME # ${ENV,var="version.label"} I dont have to go in Jenkins job configuration and change it there. I'll just change my config file and there you'll see the change in the email notification as Jenkins job's EMAIL SUBJECT box is stil containing $SUBJECT variable which's defined in our config file. 5. BASICALLY, what we need in the above request is... similarly like you allowed nested contents in the JELLY script (EMAIL CONTENT area), can we have the same "nested" capability in other parts of the JENKINS jobs where we specify some variables (it can be Email's fields/boxes, or it can be any field/box in Jenkins job's whole configuraiton). What we want to achieve here is (30000 feet view): if X=$Y and if Y=${VAR}-I_like_it and VAR=FIFA. Then X should result as: "FIFA-I_like_it" Apart from that, when can we expect the nested funcationality of Jelly to be included in the next version of Jenkins build .war? Kindly advise. Thanks. Regards Arun Sangal

          Alex Earl added a comment -

          I have no idea what you are asking. If you are asking for changes to Jenkins core, then you will need to file an issue against Jenkins core component. This issue ONLY relates to email-ext.

          Alex Earl added a comment - I have no idea what you are asking. If you are asking for changes to Jenkins core, then you will need to file an issue against Jenkins core component. This issue ONLY relates to email-ext.

            slide_o_mix Alex Earl
            giga Arun Sangal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: