Discord - BredaUniversityGames/JenkinsLib GitHub Wiki

discord.alert()

Sends build status notifications, test reports, and review notifications to a Discord channel via webhooks.

Usage

stages {
    perforce.sync()
    ue5.build()
    ue5.test()
    steam.deploy()
    discord.alert()
}

Prerequisites

  • A Discord server with a webhook configured

Parameters

Parameter Default Description
DISCORD_WEBHOOK (empty) Discord webhook URL

Creating a Discord Webhook

  1. Open your Discord server
  2. Go to Server Settings > Integrations > Webhooks
  3. Click New Webhook
  4. Choose the channel where notifications should appear
  5. Copy the webhook URL

Paste the URL as the DISCORD_WEBHOOK parameter in Jenkins.

Security note: The webhook URL is stored as a plain Jenkins parameter, not a credential. Anyone with access to the job's parameters can see it. If this is a concern, store it as a Secret text credential and modify the notification module to use withCredentials.

How It Works

Notifications run in the finally block of the pipeline — they always execute, even if the build fails.

Build Status

Sends an embed with:

  • Build result (SUCCESS, FAILURE, UNSTABLE, ABORTED) with color coding
  • Build configuration and platform
  • VCS revision
  • Link to the Jenkins build

Test Report

If ue5.test() or vs.test() ran, sends a test summary:

  • Succeeded / failed / warning counts
  • Link to the Jenkins test report

Review Notification

If swarm.review() ran, sends a review notification:

  • Link to the Swarm review
  • Review author
  • Participants

Direct-Use Methods

Available on the discord object for custom notifications:

Method Description
discord.send(buildInfo, webhook) Send build status notification
discord.sendTestReport(reportInfo, webhook) Send test report
discord.sendReviewNotification(reviewInfo, webhook) Send review notification
discord.sendCustom(title, color, fields, webhook) Send a custom embed
discord.createGroup(...) Create a group for mentions
discord.mentionGroup(name, groups) Format a Discord mention
discord.mentionGroups(names, groups) Format multiple mentions

Groups Integration

See Architecture - Groups System for the JSON groups format used with Discord mentions.

⚠️ **GitHub.com Fallback** ⚠️