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

Default pre-send script variable gets expanded inside the job confguration

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I have a groovy script set in the global configuration for this email-ext plugin as a "Default Pre-send Script". Set it up as: ${SCRIPT, template="scan-email.groovy"}

      I add this script to my job configurations as: $DEFAULT_PRESEND_SCRIPT in the field "Pre-send Script"

      The script will get called at the appropriate time when the job runs. But after the job has run, inside the jobs configuration, there will no longer be the $DEFAULT_PRESEND_SCRIPT I originally entered. That field will contain the scripts contents. Aka, it expanded the $DEFAULT_PRESEND_SCRIPT variable with the content of the script.

      Now, a setup like this will still work, but if I happen to edit this script, this job will not get the most recent changes I made to that script as it will just continue to use what is entered in its configuration.

      Expected behavior:
      I would have expected that $DEFAULT_PRESEND_SCRIPT stays as it is inside the jobs configuration. Pretty much like $DEFAULT_CONTENT does.

      Please find attached a sample job configuration and notice the difference before and after that job has run.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: unknown
          Path:
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
          http://jenkins-ci.org/commit/email-ext-plugin/c6425f4c8457f458c7de2c6399471cb5a4588e6b
          Log:
          Fix JENKINS-20770

          Used a local variable for the expanded presend script instead of
          reassigning to the original variable

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: unknown Path: src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java http://jenkins-ci.org/commit/email-ext-plugin/c6425f4c8457f458c7de2c6399471cb5a4588e6b Log: Fix JENKINS-20770 Used a local variable for the expanded presend script instead of reassigning to the original variable
          Hide
          slide_o_mix Alex Earl added a comment -

          Use a local variable instead of reassigning to the origin class variable.

          Show
          slide_o_mix Alex Earl added a comment - Use a local variable instead of reassigning to the origin class variable.
          Hide
          maccer Mac Cer added a comment - - edited

          Sorry, you wrote "Use a local variable instead of reassigning to the origin class variable." in your last comment.

          Was this supposed to be "Used a local variable for the expanded presend script instead of
          reassigning to the original variable" as you wrote in that commit?

          I'm just wondering if I am to "Use a local variable instead of reassigning to the origin class variable." as you wrote in your last comment or if this was indeed something that was corrected in the code.
          If it was something that was wrong with the code, how long would you say does it take until this change is reflected in an update to the plugin?

          Show
          maccer Mac Cer added a comment - - edited Sorry, you wrote "Use a local variable instead of reassigning to the origin class variable." in your last comment. Was this supposed to be "Used a local variable for the expanded presend script instead of reassigning to the original variable" as you wrote in that commit? I'm just wondering if I am to "Use a local variable instead of reassigning to the origin class variable." as you wrote in your last comment or if this was indeed something that was corrected in the code. If it was something that was wrong with the code, how long would you say does it take until this change is reflected in an update to the plugin?
          Hide
          slide_o_mix Alex Earl added a comment -

          The comment is what I changed in the source code. I'm planning on making a release very soon, hopefully by the end of the week.

          Show
          slide_o_mix Alex Earl added a comment - The comment is what I changed in the source code. I'm planning on making a release very soon, hopefully by the end of the week.

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              maccer Mac Cer
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: