Skip to content

jungejason/hubot-steps-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hubot Pipeline Steps

Build

Run mvn package to build a deployable hpi bundle for Jenkins. Note this plugin REQUIRES JDK 1.8 to build.

Steps & Configuration

The following Jenkins pipeline steps are available if you add this plugin to your Jenkins.

hubotSend

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 variable HUBOT_URL or provided by withEnv step, this should always end with /, environment variable takes the lower precedence.

  • room is optional, if it is provided as global environment variable HUBOT_DEFAULT_ROOM or provided by withEnv 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 is true, if any error it won’t abort the job., it can also be provided as global environment variable HUBOT_FAIL_ON_ERROR, environment variable takes the higher precedence.

hubotApprove

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 variable HUBOT_URL or provided by withEnv 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 variable HUBOT_DEFAULT_ROOM or provided by withEnv 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 is true, if any error it won’t abort the job., it can also be provided as global variable HUBOT_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?'
    Slack Example

    Jenkins Approved Job

    Slack Example

    Jenkins Aborted Job:

Slack Example

Hubot Setup

New to hubot?

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.

Already running hubot.

Then just copy over following scripts from scripts folder.

Examples

With Global Environment Variables

Global
  hubotSend message: 'test message.'
  hubotApprove message: 'Proceed with building this job?'

withEnv Variables

  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?'
  }

No Environment Variables

Screenshot:

Pipeline Syntax
  hubotSend failOnError: false, message: 'testMessage', room: 'botlab', url: 'http://192.168.1.176:9999/'
  hubotApprove failOnError: false, message: 'Proceed with building this job?', room: 'botlab', url: 'http://192.168.1.176:9999/'

Blue Ocean View

BlueOcean

Known Issues

  • hubot script doesn’t work when Prevent Cross Site Request Forgery exploits enabled in Configure Global Security.

Maintainers

Disclaimer

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

About

Jenkins pipeline steps for integration with Hubot

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 73.7%
  • CoffeeScript 24.7%
  • HTML 1.6%