Heavily influenced by DiscordHooks/travis-ci-discord-webhook.
If you are looking for a way to get build (success/failure) status reports from Gitlab CI in Discord, stop looking. You've came to the right place.
- You should be using Gitlab CI for testing code.
- A Discord Server where notifications will be posted.
- 5 minutes
- A cup of coffee ☕
-
Create a webhook in your Discord Server (Guide).
-
Copy the Webhook URL.
-
Go to your repository
Settings 🡒 CI / CD
(for which you want status notifications) in Gitlab and add an environment variable calledDISCORD_WEBHOOK
and paste the Webhook URL you got in the previous step. -
Add these lines to the
.gitlab-ci.yml
file of your repository.notify-success: stage: notify-success when: on_success script: - wget https://raw.githubusercontent.com/NurdTurd/gitlab-ci-discord-webhook/master/send.sh - bash ./send.sh success $DISCORD_WEBHOOK notify-failure: stage: notify-failure when: on_failure script: - wget https://raw.githubusercontent.com/NurdTurd/gitlab-ci-discord-webhook/master/send.sh - bash ./send.sh failure $DISCORD_WEBHOOK
-
Be sure to add both (in order)
notify-failure
andnotify-success
to yourstages
section of your.gitlab-ci.yml
. -
Grab your coffee ☕ and enjoy! And, if you liked this, please ⭐Star this repository to show your love.
- If you face any issues in the scripts (and you're sure it's not on your side), please consider opening an issue and I'll fix it ASAP.
- If you want to improve the scripts, feel free to open a pull request.
- discord.sh - Write-only command-line Discord webhook integration written in 100% Bash script.