Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

tsszh/jenkins-slack-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

The main goal of this project is to provide a smart bot, which enables the direct communication between Jenkins and Slack Channel. Users can interact with Jenkins and control various features of jobs by directly sending commands within a Slack Channel.

Implementations

The project is consist of two independent Java implementations.

  • Jenkins Plugin

    The bot is running inside Jenkins as a plugin, which is built on top of Slack plugin for Jenkins and Instant Messaging Plugin. The manager of Jenkins server must install the plugin to activate the bot.

  • Remote SlackBot

    The bot can run independently of both Jenkins and Slack. The interaction of Jenkins is implemented via Remote Access API. --- Under Construction ---

Installation Guide

  • Jenkins Plugin

    1. Install the slack plugin inside Jenkins. Please contact the Jenkins server managers for help.

    2. Create a Programming Slackbot and record the global unique token.

    3. Go to "Mange Jenkins" -> "Configure System", find the "Global Slack Bot Setting" section.

      Jenkins Global Setting

    4. Type in SlackBot token provided by Slack.

    5. If the Jenkins is protected, a valid Jenkins user Id must be provided, otherwise most commnands won't work. You can also use this to restrict which commands can be executed via the bot, by removing the respective permissions for this user.

    6. Save

    7. Go to your Slack channel and try "!jenkins botsnack apple"

      Botsnack Commands

    8. "!jenkins help" command will always provide the full list of available commands.

      Help Commands

  • Remote SlackBot

    To be Finished

Usage Demo

Demo1 Demo2 Demo3 Demo4 Demo5 Demo6

Supported Commands

####Schedule a job build, with standard, custom or no quiet period build [now|[s|m|h]] [=]* schedule [now|[s|m|h]] [=]* ####Specify which job to abort abort ####Adds a description to a build comment <build-#>


####List jobs which are currently in progress cb currentlyBuilding ####Show the health of a specific job, jobs in a view or all jobs h [|-v ] health [|-v ] ####Show the status of a specific job, jobs in a view or all jobs jobs [|-v ] s [|-v ] status [|-v ] ####Show the state of the build queue q queue ####Show the test results of a specific job, jobs in a view or all jobs testresult [|-v ] ####Prints information about a Jenkins user userstat


####Defines a new alias, deletes one or lists all existing aliases alias [ []] ####Connection Test botsnack []