Execute a global configured groovy script after each build of each job managed by the Jenkins. Notice: jython script support removed since 1.1.0 Plugin Information View Global Post Script on the plugin site for more information. The current version of this plugin may not be safe to use. Please review the following warnings before use:
This is typical for cases when you need to do something based on a shared set of parameters, such as triggering downstream jobs managed by the same Jenkins or remote ones based on the parameters been passed to the parameterized jobs.
Notice: jython script support removed since 1.1.0
View Global Post Script on the plugin site for more information.
The current version of this plugin may not be safe to use. Please review the following warnings before use:
Default: the script will be executed when the build result is better or equal to
Variables that could be used in the script file
Jenkins Built-in Variables
Build timestamp as ID
SUCCESS / UNSTABLE / FAILURE ...
Job Name + Build No#
The URL of this build
The path of the root folder of Jenkins
The root URL of Jenkins
Name of the job
URL of the job
Maven command args
Lables of the nodes where the build could be executed
Name of the node where the build executed
The path of the workspace
Git commit ID
Git repo URL
parameterized build or parameters been passed in by
-Dparameter_name=parameter_value are also available
An extra object is available as groovy variables:
manager, provided 4 methods:
Check if a variable is defined and usable in the script
Check if a variable is defined and usable in the script, and with a non-blank value
Add a badge to the build
Add a text label to the build
Trigger a job managed by the same Jenkins
Trigger a job by URL
3rd-party libraries for groovy script
If your groovy script have dependencies that not shipped with Jenkins, you can put them into
NO variables will passed into the script
- Added support for `pipeline`JENKINS-44647
- Fixed JENKINS-37796 Loading jars in
global-post-script/lib(if exist) as classpath entries when running groovy script.
- Not the cache the parsed GroovyShell
- *Do NOT use this version*
- Fixed JENKINS-34056
- *Do NOT use this version*
- Parsing and caching the groovy script, to make a smaller footprint. JENKINS-33358
- Added `aborted` condition, to allow triggering the script even the build is aborted.
- Removed support for jython scripts. (jython dependency is too big, and Groovy is much better supported by Jenkins.)
- Fixed issue about script been executed for each sub-module of Maven multi-module projects.
- Fixed issue about groovy script works in
script consolebut fails as
global post script
- Allow to run also for failed builds (Global configure).
- Added BUILD_RESULT to script.
- Supports parameters when triggering local jobs (parameterized downstream jobs)