Giter Site home page Giter Site logo

levelupsoft / mattermost-plugin-jenkins Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mattermost-community/mattermost-plugin-jenkins

0.0 0.0 0.0 2.21 MB

A Mattermost plugin to interact with Jenkins

License: MIT License

Makefile 10.09% Go 89.91%

mattermost-plugin-jenkins's Introduction

Mattermost Jenkins Plugin

Build Status Code Coverage

A Jenkins plugin to interact with jobs and builds, with slash commands in Mattermost.

Originally developed by Wasim Thabraze.

drawing

By extending Mattermost with the Jenkins integration, your team will enjoy:

  • Improved collaboration. Keep your team in sync with your latest build by automatically routing notifications to specific Mattermost Channels to display information about when builds start, whether they’re successful, or if exceptions occurred.
  • Increased productivity. Start Jenkins job builds and get logs and artifacts—all without leaving the Mattermost platform.
  • Centralized workflows. Consolidate builds into one channel to keep a timeline of key Jenkins builds in one place and avoid hunting across builds.

Integrating Mattermost with Jenkins lets you keep your whole DevOps team on top of recent builds and any failures that may occur. With the Mattermost Jenkins plugin, control over Jenkins functions is always at the fingertips of your entire DevOps team.

By using the Mattermost Jenkins integration, your team will spend less time switching over to Jenkins, logging in, and finishing builds.

Plugin for Jenkins Server

For a Jenkins integration that sends webhook notifications from Jenkins to Mattermost as post-build actions, see this repository: https://github.com/jenkinsci/mattermost-plugin This is useful for sending Jenkins notifications to specific channels. For example - whenever a new Release of your software is cut, it should notify the #Release channel in Mattermost. Using the Jenkins post-build action plugin lets you notify the right channels about success/failures.

Features

This plugin enables you to interact with jobs via slash commands in Mattermost. The supported slash commands are listed below:

Connect and disconnect with Jenkins server

  • Connect to Jenkins server - /jenkins connect username APIToken - Connect your Mattermost account to Jenkins.
  • Disconnect from Jenkins server - /jenkins disconnect - Disconnect your Mattermost account from Jenkins.

Interact with Jenkins jobs

  • Create a Jenkins job - /jenkins createjob - Create a Jenkins job using contents of config.xml. The slash command opens an interactive dialog for the user to input the job name and paste the contents of config.xml.

  • Trigger a Jenkins job - /jenkins build jobname - Trigger a build for the given job. If the job accepts parameters, an interactive dialog pops up for the user to input the required parameters.

    • If the job resides in a folder, specify the job as folder1/jobname. Note the slash character.
    • If the folder name or job name has spaces in it, wrap the jobname in double quotes as "job name with space" or "folder with space/jobname".
    • Follow similar pattern for all commands which takes jobname as input.
  • Abort a build - /jenkins abort jobname <build number> - Abort the given build of the specified job. If build number is not specified, the command aborts the last build of the job.

  • Enable a job - /jenkins enable jobname - Enable a given Jenkins job.

  • Disable a job - /jenkins disable jobname - Disable a given Jenkins job.

  • Delete a job - /jenkins delete jobname - Delete a given job.

  • Get artifacts - /jenkins get-artifacts jobname - Get artifacts of the last build of the given job.

  • Get test results - /jenkins test-results jobname - Get test results of the last build of the given job.

  • Get build log - /jenkins get-log jobname <build number> - Get log of a given build of the specified job as a file attachment to the channel. If build number is not specified, the command fetches the log of the last build of the job.

Interact with Plugins

  • List of installed plugins - /jenkins plugins - Get a list of installed plugins on Jenkins server along with the version of the plugin.

Adhoc commands

  • Safe restart Jenkins server - /jenkins safe-restart - Safe restart the Jenkins server.
  • Find connected Jenkins account - /jenkins me - Display the connected Jenkins account.
  • Get help - /jenkins help - Find help related to the syntax of the slash commands.

Installation

  1. Install the plugin
    1. Download the latest version of the plugin from the GitHub releases page
    2. In Mattermost, go to System Console -> Plugins -> Management
    3. Upload the plugin
  2. Enter Jenkins server URL
    1. Go to the System Console -> Plugins -> Jenkins
    2. Set the Jenkins server URL along with the protocol. Example: http://jenkins.example.com, https://jenkins.example.com
    3. Save the settings
  3. Generate an at rest encryption key
    1. Go to the System Console -> Plugins -> Jenkins and click "Regenerate" under "At Rest Encryption Key"
    2. Save the settings
  4. Enable the plugin
    1. Go to System Console -> Plugins -> Management and click "Enable" underneath the Jenkins plugin
  5. Test it out
    1. In Mattermost, run the slash command /jenkins connect <Jenkins Username> <Jenkins API Token>

Development

make

This will produce a single plugin file (with support for multiple architectures) that can be uploaded to your Mattermost server:

dist/jenkins-0.0.x.tar.gz

After the plugin is built, deploy it using Mattermost system console and test it out.

FAQ

How do I generate API Token for a given Jenkins user?

Since Jenkins 2.129 the API token configuration has changed:

You can now have multiple tokens and name them. They can be revoked individually.

  1. Log in to Jenkins.
  2. Click you name (upper-right corner).
  3. Click Configure (left-side menu).
  4. Use "Add new Token" button to generate a new one then name it.
  5. You must copy the token when you generate it as you cannot view the token afterwards.
  6. Revoke old tokens when no longer needed.

Before Jenkins 2.129: Show the API token as follows:

  1. Log in to Jenkins.
  2. Click your name (upper-right corner).
  3. Click Configure (left-side menu).
  4. Click Show API Token.

Source : https://stackoverflow.com/a/45466184/6852930

License

MIT

mattermost-plugin-jenkins's People

Contributors

aaronrothschild avatar abdulsmapara avatar bbodenmiller avatar byeongsupark avatar cpoile avatar crspeller avatar danielsz50 avatar hanzei avatar hectorgabucio avatar jasonblais avatar justinegeffen avatar mickmister avatar nathanaelhoun avatar waseem18 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.