Jenkins Pipeline Steps for integration with the Hubot Chat Bot and with human approval.
Run mvn package
to build a deployable hpi bundle for Jenkins. Note this plugin REQUIRES JDK 1.8 to build.
The following Jenkins pipeline steps are available if you add this plugin to your Jenkins.
Allows sending of a message to the hubot chat bot
hubotSend room: 'release', message: 'Releasing this project.', url: 'http://localhost:9999', failOnError: true
-
url
is optional, if it is provided as global environment variableHUBOT_URL
or provided bywithEnv
step, this should always end with/
, environment variable takes the lower precedence. -
room
is optional, if it is provided as global environment variableHUBOT_DEFAULT_ROOM
or provided bywithEnv
step, and room doesn’t require#
, it is added in the code, environment variable takes the lower precedence. -
message
is required, actual message to be sent. Which is being prefixed with Job: #BUILD_URL string. -
failOnError
is optional and by default it istrue
, if any error it won’t abort the job., it can also be provided as global environment variableHUBOT_FAIL_ON_ERROR
, environment variable takes the higher precedence.
Sends a hubot message the project chat room for a project when the build is waiting for user input with the hubot commands to proceed or abort the build.
hubotApprove room: 'release', message: 'Proceed with building this Job?', url: 'http://localhost:9999/', failOnError: true
-
url
is optional, if it is provided as global environment variableHUBOT_URL
or provided bywithEnv
step, this should always end with/
, environment variable takes the lower precedence. -
message
is required, actual message to be sent. Which is being prefixed with Job: #BUILD_URL string. -
room
is optional, if it is provided as global environment variableHUBOT_DEFAULT_ROOM
or provided bywithEnv
step, and room doesn’t require#
, it is added in the code, environment variable takes the lower precedence. -
failOnError
is optional and by default it istrue
, if any error it won’t abort the job., it can also be provided as global variableHUBOT_FAIL_ON_ERROR
, environment variable takes the higher precedence. -
Example
// Note: HUBOT_URL and HUBOT_DEFAULT_ROOM set as global environment variables. hubotApprove message: 'Proceed with building this job?'
Jenkins Approved Job
Jenkins Aborted Job:
Refer to hubot-base to setup a either docker container or to run it locally.
💡
|
Please replace scripts on hubot-base repo with the scripts under this hubot-steps repo and it is always a good idea to copy over the scripts from appropriate tag based on the version being installed on Jenkins. |
hubotSend message: 'test message.'
hubotApprove message: 'Proceed with building this job?'
withEnv(['HUBOT_URL=http://192.168.1.176:9999','HUBOT_DEFAULT_ROOM=botlab','HUBOT_FAIL_ON_ERROR=false']) {
hubotSend message: 'building job $BUILD_URL'
hubotApprove message: 'Proceed with building this job?'
}
-
hubot script doesn’t work when Prevent Cross Site Request Forgery exploits enabled in Configure Global Security.
Please don’t hesitate to log a JIRA or github pull request if you need any help or if you can be of help with this plugin :). Refer to the contribution guide for more inforamtion.
Developed by Naresh Rayapati, this repo was initially cloned from ThoughtsLive