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

Default pre-send script in Jenkins Configuration

    Details

    • Similar Issues:

      Description

      It would be very nice, if there is also an input field for a default pre-send script like the default email content and recipients which is triggered if the according placeholder (e.g. ${DEFAULT_PRE-SEND_SCRIPT}) is present in the project configuration.

        Attachments

          Issue Links

            Activity

            Hide
            slide_o_mix Alex Earl added a comment -

            Are you wanting this at the global config level?

            Show
            slide_o_mix Alex Earl added a comment - Are you wanting this at the global config level?
            Hide
            mabahj Markus added a comment -

            That is how at least I'd like it. All the other fields have a global config level DEFAULT option, but the pre-sim script does not. Adding ${DEFAULT_PRE-SEND_SCRIPT} in the pre-sim script field in a job (it should maybe be there by default), should execute a pre-sim script defined globally. It would make it much easier to run the same script on all the jobs.

            An alternative could be to adds support for ${SCRIPT, script="my-default-script.groovy"}, which is fetched from the email-templates directory.

            Or even better - both. Let the pre-sim script behave like all the other fields.

            Show
            mabahj Markus added a comment - That is how at least I'd like it. All the other fields have a global config level DEFAULT option, but the pre-sim script does not. Adding ${DEFAULT_PRE-SEND_SCRIPT} in the pre-sim script field in a job (it should maybe be there by default), should execute a pre-sim script defined globally. It would make it much easier to run the same script on all the jobs. An alternative could be to adds support for ${SCRIPT, script="my-default-script.groovy"}, which is fetched from the email-templates directory. Or even better - both. Let the pre-sim script behave like all the other fields.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Alex Earl
            Path:
            src/main/java/hudson/plugins/emailext/AttachmentUtils.java
            src/main/java/hudson/plugins/emailext/EmailToken.java
            src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
            src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java
            src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java
            src/main/java/hudson/plugins/emailext/plugins/EmailToken.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildIdContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildLogContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildLogExcerptContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildLogMultilineRegexContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildLogRegexContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildNumberContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildStatusContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/BuildURLContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/CauseContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/ChangesSinceLastBuildContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/ChangesSinceLastSuccessfulBuildContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/ChangesSinceLastUnstableBuildContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/FailedTestsContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/JenkinsURLContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/JobDescriptionContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/ProjectNameContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/ProjectURLContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/SVNRevisionContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/TestCountsContent.java
            src/main/java/hudson/plugins/emailext/plugins/content/WorkspaceFileContent.java
            src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/config.groovy
            src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/global.groovy
            src/main/resources/lib/email-ext/tokenhelp.jelly
            src/main/webapp/help/globalConfig/defaultPresendScript.html
            src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTest.java
            http://jenkins-ci.org/commit/email-ext-plugin/c9e56e459d6fce1dddad937d10d06b9103b6a97d
            Log:
            Fix JENKINS-14508

            Added default presend script and DEFAULT_PRESEND_SCRIPT token to be used in the
            project settings. Also added ability to use content tokens in pre-send script area
            so that the pre-send script could be loaded from the templates area if desired.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/emailext/AttachmentUtils.java src/main/java/hudson/plugins/emailext/EmailToken.java src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java src/main/java/hudson/plugins/emailext/ExtendedEmailPublisherDescriptor.java src/main/java/hudson/plugins/emailext/plugins/ContentBuilder.java src/main/java/hudson/plugins/emailext/plugins/EmailToken.java src/main/java/hudson/plugins/emailext/plugins/content/BuildIdContent.java src/main/java/hudson/plugins/emailext/plugins/content/BuildLogContent.java src/main/java/hudson/plugins/emailext/plugins/content/BuildLogExcerptContent.java src/main/java/hudson/plugins/emailext/plugins/content/BuildLogMultilineRegexContent.java src/main/java/hudson/plugins/emailext/plugins/content/BuildLogRegexContent.java src/main/java/hudson/plugins/emailext/plugins/content/BuildNumberContent.java src/main/java/hudson/plugins/emailext/plugins/content/BuildStatusContent.java src/main/java/hudson/plugins/emailext/plugins/content/BuildURLContent.java src/main/java/hudson/plugins/emailext/plugins/content/CauseContent.java src/main/java/hudson/plugins/emailext/plugins/content/ChangesSinceLastBuildContent.java src/main/java/hudson/plugins/emailext/plugins/content/ChangesSinceLastSuccessfulBuildContent.java src/main/java/hudson/plugins/emailext/plugins/content/ChangesSinceLastUnstableBuildContent.java src/main/java/hudson/plugins/emailext/plugins/content/FailedTestsContent.java src/main/java/hudson/plugins/emailext/plugins/content/JellyScriptContent.java src/main/java/hudson/plugins/emailext/plugins/content/JenkinsURLContent.java src/main/java/hudson/plugins/emailext/plugins/content/JobDescriptionContent.java src/main/java/hudson/plugins/emailext/plugins/content/ProjectNameContent.java src/main/java/hudson/plugins/emailext/plugins/content/ProjectURLContent.java src/main/java/hudson/plugins/emailext/plugins/content/SVNRevisionContent.java src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java src/main/java/hudson/plugins/emailext/plugins/content/TestCountsContent.java src/main/java/hudson/plugins/emailext/plugins/content/WorkspaceFileContent.java src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/config.groovy src/main/resources/hudson/plugins/emailext/ExtendedEmailPublisher/global.groovy src/main/resources/lib/email-ext/tokenhelp.jelly src/main/webapp/help/globalConfig/defaultPresendScript.html src/test/java/hudson/plugins/emailext/plugins/ContentBuilderTest.java http://jenkins-ci.org/commit/email-ext-plugin/c9e56e459d6fce1dddad937d10d06b9103b6a97d Log: Fix JENKINS-14508 Added default presend script and DEFAULT_PRESEND_SCRIPT token to be used in the project settings. Also added ability to use content tokens in pre-send script area so that the pre-send script could be loaded from the templates area if desired.
            Hide
            slide_o_mix Alex Earl added a comment -

            Added default pre-send script

            Show
            slide_o_mix Alex Earl added a comment - Added default pre-send script
            Hide
            mabahj Markus added a comment -

            Great! Thank you!

            Show
            mabahj Markus added a comment - Great! Thank you!
            Hide
            maccer Mac Cer added a comment -

            Hey, is it intended behavior to have the $DEFAULT_PRESEND_SCRIPT be expanded after a Job that had it included in its configuration ran?
            Cause that's what happens with my Jenkins 1.509.4 and Version 2.36 of this plugin.

            I find this a little inconvenient. What if I want to make changes to my script? Every Job that I have set up with "$DEFAULT_PRESEND_SCRIPT" in its configuration would have the old version of that script expanded in its configuration after it ran at least once. I would have to go through every job config and change it back to "$DEFAULT_PRESEND_SCRIPT" to have to load the newest version of that script.

            This expansion happens every time. I tried writing it as $DEFAULT_PRESEND_SCRIPT and ${DEFAULT_PRESEND_SCRIPT}. Both times it gets expanded.

            Show
            maccer Mac Cer added a comment - Hey, is it intended behavior to have the $DEFAULT_PRESEND_SCRIPT be expanded after a Job that had it included in its configuration ran? Cause that's what happens with my Jenkins 1.509.4 and Version 2.36 of this plugin. I find this a little inconvenient. What if I want to make changes to my script? Every Job that I have set up with "$DEFAULT_PRESEND_SCRIPT" in its configuration would have the old version of that script expanded in its configuration after it ran at least once. I would have to go through every job config and change it back to "$DEFAULT_PRESEND_SCRIPT" to have to load the newest version of that script. This expansion happens every time. I tried writing it as $DEFAULT_PRESEND_SCRIPT and ${DEFAULT_PRESEND_SCRIPT}. Both times it gets expanded.
            Hide
            slide_o_mix Alex Earl added a comment -

            Can you post a config.xml before and after?

            Show
            slide_o_mix Alex Earl added a comment - Can you post a config.xml before and after?
            Hide
            slide_o_mix Alex Earl added a comment -

            Also, please file a new issue since the issue you are describing is different from the one this one is describing.

            Show
            slide_o_mix Alex Earl added a comment - Also, please file a new issue since the issue you are describing is different from the one this one is describing.

              People

              • Assignee:
                slide_o_mix Alex Earl
                Reporter:
                robin_h00d Robin Pradel
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: