The PostBuildScript Jenkins plugin lets you execute a set of scripts at the end of the build depending on the build status.
This plugin allows you to run the following actions after a build:
You can configure these actions depending on the build status (i.e., only run when build is successful). Scripts can also be executed on the master, on slaves or both. On matrix projects, the build can be executed on each axis.
Please refer to the plugin description for further information.
You'll find the latest HPI files of the plugin here:
http://updates.jenkins-ci.org/download/plugins/postbuildscript
Just put a HPI file into your plugins subdirectory of your Jenkins installation root, e.g. /var/lib/jenkins. Restart Jenkins afterwards.
Please use the official Jenkins Jira project and issue tracking software to report new bugs or request features.
Please first look through Jira. If a ticket already exists, please add a comment and try to explain the issue a little more further. If no ticket exists, please open a new one.
In general please provide example configurations (config.xml, Job DSL scripts, ...) and also screenshots are very helpful to reproduce problems.
Please try to be constructive. If you have a feedback, it's better to write me a direct message.
For bug fixes and enhancements to existing features, first make sure an issue is filed by checking this Jira filter
After that please create a pull request on GitHub with your change and link to the JIRA issue in the PR, and link to the PR from the JIRA issue.
Dependencies require Jenkins 2.359, so this will be the new base version for the PostBuildScript plugin.
Updated Jenkins Plugin Parent to Version 4.32 to ensure, that no Log4j issues exist. Also updated Matrix Project dependency to 1.19, which requires at least Jenkins 2.282. Therefore switched to Jenkins version 2.289.
I removed several deprecated configuration parts in this version. They were deprecated long time ago on very old versions. On https://stats.jenkins.io/plugin-installation-trend/postbuildscript.stats.json you can see, that most installations use version 2.11.0 of this plugin now. Most versions silently upgrade to a newer configuration, so I recommend to first upgrade minor versions and save your job configurations. For most users there won't be a problem, but users of very old plugin versions < 2.8.0 should first upgrade to at least 2.8.0 and save their job configurations.
Users of the Jenkins Job DSL should use the dynamic DSL and not the old manual implementation of the PostBuildScript publisher.
Removed access to workspace on master for Groovy script execution, because secure groovy scripts cannot be configured on slaves when using a master-to-slave callable. Groovy scripts may not access files of the master's workspace as a result. However Groovy scripts can be run on slaves again. Thanks to John David for reporting this issue.
If the shebang contains a space in front of the interpreter, it will be stripped out.
This version introduces the ability to run Groovy scripts in a sandbox when activated using the checkbox in the configuration view.
Now you can also select for each script whether it should be executed on each axe or on the whole matrix.
The old option to build only on success or on failure will now be migrated differently: If both is not selected, the behavior of versions previous to 1.0.0 was to build it independent of the actual build result. Previous versions (after 1.0.0) simply migrate that to do nothing. With version 2.4.0 every build result will be selected in such cases.
Removing deprecated fields from configuration
Using default values for results and roles on newly created script items.
Unified script file handling.
There are separate messages now, if a script is not run because the build result or the role does not fit.
Dan Clayton added the BUILD_RESULT variable to allow handling script actions depending on the build result.
Refactored the way, how script files are differentiated. This ensures extensibility and helps removing redundant code.
Also removed null pointer exception that occurs on executing a postbuild groovy script on an agent.
Fixed some bugs that came in with the release of a new major version. Sorry for the inconvenience.
Attention: This is a major refactoring of the plugin. It hasn't been updated for years now. The configuration was changed, but your existing configuration will be automatically migrated to the new format. I cannot reproduce every configuration, so please open a bug ticket (and try to be kind, I'm doing this in my free time and don't want to harm anyone).