This plugin sends messages and notifications of build statuses to Zulip.
It began its life as a fork of the Jenkins Campfire plugin.
The Zulip server is configured globally for the whole Jenkins instance.
Minimal configuration is:
Other attributes are optional:
Enable Smart Notification = If enabled, successful build notification will be sent out only if one of following criteria is met:
In another words, the notifications will not be sent for continuously successful builds.
Use full job path in default topic name = Determines how the topic name is constructed when Default topic name is blank:
It is recommended to have this option on, especially if you use projects with multiple layers (e.g. multi-branch pipeline).
Use full job path in notification message = Determines how the build notification message is constructed.
It is recommended to have this option on, especially if you use projects with multiple layers (e.g. multi-branch pipeline).
Zulip notification is a post build action step, that posts notification about build statuses to Zulip Streams. The step allows you to configure two optional parameters:
For freestyle project, simply select a post build action from the dropdown and optionally configure destination stream and topic.
Scripted pipeline have no concept of post build actions, but you can still use the zulipNotification
step in the try/catch or preferably using the catchError
step.
node {
catchError {
// ... Your build stages ...
}
zulipNotification stream: 'coolproject', topic: 'jenkins', smartNotification: 'enabled'
}
In declarative pipeline, simply use the zulipNotification
step inside your post actions.
pipeline {
agent any
stages {
// ... Your build stages ...
}
post {
always {
zulipNotification()
}
}
}
Zulip send is a build step, that allows you to post arbitrary messages to Zulip stream throughout the build process. You can use this e.g. to notify Zulip that build has started or about various phases the build goes through. The step allows you to configure:
For freestyle project, simply select a build action from the dropdown and fill in desired message. Optionally configure destination stream and topic.
In scripted pipeline, simply use the zulipSend
step in any stage of the build.
node {
stage('Prepare') {
zulipSend message: 'Started build #${BUILD_NUMBER} of project ${JOB_NAME}...'
// ... Perhaps SCM checkout here ...
}
// ... Other build stages ...
}
In declarative pipeline, simply use the zulipSend
step in any stage of the build.
pipeline {
agent any
stages {
stage('Prepare') {
steps {
zulipSend message: 'Started build #${BUILD_NUMBER} of project ${JOB_NAME}...'
// ... Perhaps SCM checkout here ...
}
}
// ... Other build stages ...
}
}
There is no explicit support for the Job DSL Plugin, but Zulip Send step and Zulip Notification can be configured via dynamically generated DSLs.
Example DSL creating a freestyle job using both Zulip Send and Zulip Notification:
job('DSL-Freestyle') {
steps {
zulipSend {
message('Hello via job DSL!')
stream('dslproject')
topic('jenkins')
}
}
publishers {
zulipNotification {
stream('dslproject')
topic('jenkins')
}
}
}
If you're using 1.x version of Jenkins and 1.x version of workflow job plugin (previous name for the pipeline jobs)
you will encounter exceptions like java.lang.NoSuchMethodError: No such DSL method zulipSend found among [...]
.
In that case, you will have to use the meta-step instead. Simply replace:
zulipSend message: 'Test'
with
step([$class: 'ZulipSendStep', message: 'Test'])
and
zulipNotification()
with
step([$class: 'ZulipNotifier'])