Operations 10 min read

Integrating Mattermost with Jenkins for ChatOps and CI/CD Pipelines

This guide explains how to install Mattermost on CentOS, configure a MySQL database and Nginx proxy, and integrate it with Jenkins using the Mattermost Jenkins plugin and pipeline scripts to enable ChatOps‑style notifications throughout the CI/CD workflow.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Integrating Mattermost with Jenkins for ChatOps and CI/CD Pipelines

The article introduces ChatOps and NoOps concepts, highlighting how messaging platforms like Mattermost can unify people, tools, and automation to improve productivity, reliability, and incident response in modern DevOps environments.

It describes Mattermost as an open‑source, self‑hosted messaging solution that integrates with popular DevOps tools such as Jenkins, Jira, GitLab, and others, providing a central hub for planning, coding, building, testing, releasing, deploying, and monitoring.

Mattermost installation : The guide recommends deploying the Mattermost server on CentOS, installing MySQL 5.7, creating a dedicated database and user, and then downloading and extracting the Mattermost tarball. Key commands are:

# Download MySQL repo
wget http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
yum localinstall mysql57-community-release-el7-9.noarch.rpm
# Install MySQL
yum install mysql-community-server
systemctl start mysqld.service
systemctl enable mysqld
# Secure MySQL and create DB/user
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password42!';
CREATE USER 'mmuser'@'%' IDENTIFIED BY 'mmuser-password';
CREATE DATABASE mattermost;
GRANT ALL PRIVILEGES ON mattermost.* TO 'mmuser'@'%';

Next, it installs Mattermost Server:

wget https://releases.mattermost.com/X.X.X/mattermost-X.X.X-linux-amd64.tar.gz
tar -xvzf *.gz
mv mattermost /opt
mkdir /opt/mattermost/data
useradd --system --user-group mattermost
chown -R mattermost:mattermost /opt/mattermost
chmod -R g+w /opt/mattermost

The configuration file /opt/mattermost/config/config.json is edited to set SiteURL and MySQL connection details, then the service is registered with systemd and started.

Nginx reverse proxy is configured to forward HTTP traffic to the Mattermost backend, with caching and timeout settings. Example snippet:

upstream backend {
    server xxxxxxxx:8065;
    keepalive 32;
}
server {
    listen 80;
    server_name mattermost.xxxxx.site;
    location / {
        proxy_pass http://backend;
        proxy_set_header Host $http_host;
        ...
    }
}

After confirming the web UI is reachable, the article moves to Jenkins integration.

Jenkins integration : By installing the Mattermost Jenkins plugin from the Plugin Marketplace, users can configure a Jenkins server URL and enable slash commands (e.g., /jenkins connect , /jenkins build ) to interact with jobs directly from Mattermost channels.

Sample Jenkins pipeline that sends a Mattermost notification when a build starts:

pipeline {
    agent any
    stages {
        stage('Hello') {
            steps {
                script {
                    mattermostSend channel: '#town-square',
                                   color: '#439FE0',
                                   endpoint: 'http://xxxx/hooks/bix8xjcb9byefj6rioht1ymrpo',
                                   message: "Build Started: ${env.JOB_NAME} ${env.BUILD_NUMBER}",
                                   text: '@young'
                    echo 'Hello World'
                    sleep 10
                }
            }
        }
    }
}

Finally, the guide shows how to add an incoming webhook in Mattermost, copy the generated URL, and reference it in the pipeline to deliver real‑time build status messages, completing a full ChatOps loop for CI/CD.

dockerIntegrationCI/CDDevOpsJenkinsChatOpsMattermost
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.