This is a plugin for Jenkins that will post build results to a Salesforce Chatter feed or arbitrary text from a build step. You can configure it to post to a specific User (e.g. a build user), a specific group (e.g. a group that owns the build), or a specific record (perhaps you have a custom object that tracks build configs).
Older versions of this plugin may not be safe to use. Please review the
following warnings before using a version before 2.0.4
:
- Unprivileged users with Overall/Read access are able to enumerate credential IDs
- CSRF vulnerability and missing permission checks allowed capturing credentials
The plugin is available via the main Jenkins plugin distribution, so go to the manage Jenkins page, manage plugins, and then the available tab and search for Chatter Notifier and pick the option to install it.
Create new credentials of the kind "Username with Password"
- Remember to include your users API security token if needed as part of the password
- Add post-build action -> Chatter Results or Add build step → Post to Chatter
- Populate the fields as needed (see the inline help for more
details):
- Credentials (use the central Jenkins credentials tool to create one)
- Optional server URL to login to
- Record id (record, user, or group) to post results to that specific record (or group) (leave this blank to post to the user's wall)
Configure a step within the context of a node. See the Jenkins Snippet Generator for more information.
Example:
chatterPost body: "This is a Chatter post from a pipeline! ${env.JOB_NAME} ${env.BUILD_DISPLAY_NAME}", credentialsId: 'JENKINS_CREDENTIAL_ID', recordId: 'SOME_RECORD_ID'
With the plug-in installed, and the server restarted, the build configuration page will now have an extra Post-Build
option Chatter Results
, if you select this, then
This option allows to publish the coverage results generated by Enforce, the post should look something like this.
Build: SForce-CI-Project-job 2 is SUCCESS
Coverage Result: 76.91% of code coverage, Risk status.
Coverage Status: Danger (0% - 74%): 298 files. Risk (75% - 79%): 84 files. Acceptable (80% - 94%): 267 files. Safe (95% - 100%): 277 files.
Test Result: 0 tests failing out of a total of 3,276 tests.
Additionally, there is a Post to Chatter
build step which is compatible with
pipelines. You can post any arbitrary body to the feed of your Chatter user or the wall
of any recordId (e.g. Chatter group).
Sample pipeline configuration (see the Jenkins Snippet Generator for more help getting your credentialsId):
node {
chatterPost body: "This is a Chatter post from a pipeline! ${env.JOB_NAME} ${env.BUILD_DISPLAY_NAME}", credentialsId: 'JENKINS_CREDENTIAL_ID', recordId: 'SOME_RECORD_ID'
}
This is how your post will look:
The plugin is built with Maven, same as Jenkins itself, simply clone to repo and run mvn install, the generated plugin ChatterPlugin.hpi will be in the target directory.
More details on building Jenkins plugins are available on the Jenkins Wiki
This plugin uses the proxy configuration from Manage Jenkins -> Manage Plugins -> Advanced The only thing that is currently not implemented is utilized is the No Proxy Hosts field.