CI Insights Setup – Jenkins

Enable Mergify CI Insights and configure flaky test detection using Jenkins.


Enabling CI Insights for Jenkins

Section titled Enabling CI Insights for Jenkins
  1. Enable CI Insights on your repositories by visiting the GitHub Integration page (docs).

  2. Install and configure the Mergify Jenkins plugin:

    Installation:

    • Go to Manage JenkinsManage Plugins
    • Select the Available tab
    • Search for Mergify and select the checkbox next to Mergify Plugin
    • Install the plugin using one of the install buttons at the bottom
    • To verify installation, search for Mergify Plugin on the Installed tab
    CI Insights Jenkins installation

    Configuration: After installation, you need to add the Mergify CI Insights API Key for each GitHub organization you want to support. Go to Manage JenkinsConfigure System and configure the Mergify plugin with your API keys.

    CI Insights Jenkins configuration

    Note: It’s highly recommended to set the GitHub project URL for each job if you’re not using the GitHub Branch Source plugin. This ensures proper correlation between Jenkins jobs and GitHub repositories.

  3. Configure your Jenkins pipeline job with the MERGIFY_TOKEN environment variable. First, get your token from the Mergify dashboard by going to Settings > CI Insights:

    CI Insights Token

    Then add the token to Jenkins credentials and configure your pipeline to use it:

    pipeline {
        agent any
        environment {
            MERGIFY_TOKEN = credentials('MERGIFY_TOKEN')
        }
        ...
    }

    Make sure to store your Mergify token as a Jenkins credential with the ID MERGIFY_TOKEN.

  4. Click on CI Insights in the Mergify dashboard navigation. You should start seeing your Jenkins job runs appear:

    CI Insights Jobs