Jenkins plugin sending POST request as a post-build action with configurable JSON payload.
By default payload submitted contains the details of the build (build number, build result, job and log URLs), URLs of artifacts generated, Git branch and commit SHA.
But being a configurable Groovy template it can contain any Jenkins, job or build details you may think of!
JSON payload is rendered as a Groovy template, having the following variables in scope:
jenkins
- instance ofjenkins.model.Jenkins
build
- instance ofhudson.model.AbstractBuild
env
- instance ofhudson.EnvVars
corresponding to the current build process
Here's a RequestBin of submitting a default payload:
In addition, json( Object )
helper function is available, rendering any Object
provided as JSON.
For example:
{
"items": ${ json( jenkins.allItems ) },
"computers": ${ json( jenkins.computers.collect{ it.displayName }) },
"moduleRoots": ${ json( build.moduleRoots )},
"artifacts": ${ json( build.artifacts )},
"env": ${ json( env ) },
"properties": ${ json( [ system: System.properties.keySet(), env: env.keySet() ]) }
}
mvn clean package -s settings.xml
cp -f target/*.hpi ~/.jenkins/plugins