A lightweight Drone CI plugin to send build notifications to Gotify with customizable messages and formatting.
- About
- Features
- Getting Started
- Usage
- Environment Variables
- Configuration
- Troubleshooting
- Contributing
- License
drone-gotify is a plugin for Drone CI that integrates seamlessly with Gotify, a simple server for sending and receiving notifications. Use this plugin to send build status updates, test results, and custom notifications to your Gotify instance directly from your CI/CD pipeline. This project is based on the drone-telegram plugin.
- Build Status Notifications: Automatically send pass/fail status with custom messages
- Template Support: Use Drone CI variables in titles and messages (e.g.,
{{build.number}},{{repo.name}}) - Markdown Formatting: Render messages as Markdown in Gotify clients
- Priority Control: Set message priority levels (1-10) for important notifications
- Click Actions: Add clickable URLs to notifications for quick access to build details
- Environment-based Configuration: Configure via environment variables or
.envfiles - Docker-ready: Pre-built Docker image available on Docker Hub
- A running Gotify server instance
- A valid Gotify app token
- Drone CI configured in your repository
Add the plugin to your .drone.yml:
steps:
- name: notify-gotify
image: dipievil/drone-gotify
settings:
url: https://my-gotify-instance:8081
token: your-gotify-app-tokenBy default, the plugin sends build status notifications:
On success:
β
Build #42 of `my-repo` succeeded.
Commit by `john.doe` on `main`:
chore: update README.md
π https://drone.example.com/my-repo/42On failure:
β Build #42 of `my-repo` failed.
Commit by `john.doe` on `main`:
chore: update README.md
π https://drone.example.com/my-repo/42Customize the notification title with template variables:
steps:
- name: notify-gotify
image: dipievil/drone-gotify
settings:
url: https://my-gotify-instance:8081
token: your-gotify-app-token
title: "Build #{{build.number}} - {{repo.name}} [{{build.status}}]"Mark important builds as critical:
steps:
- name: notify-gotify
image: dipievil/drone-gotify
settings:
url: https://my-gotify-instance:8081
token: your-gotify-app-token
priority: 10Message output:
β
Build #42 of `my-repo` succeeded.
Commit by `john.doe` on `main`:
chore: update README.md
π https://drone.example.com/my-repo/42
π‘ Critical priority
Render message as Markdown in Gotify clients:
steps:
- name: notify-gotify
image: dipievil/drone-gotify
settings:
url: https://my-gotify-instance:8081
token: your-gotify-app-token
markdown: trueAdd a clickable link to notification:
steps:
- name: notify-gotify
image: dipievil/drone-gotify
settings:
url: https://my-gotify-instance:8081
token: your-gotify-app-token
click_url: "https://drone.example.com/{{repo.owner}}/{{repo.name}}/{{build.number}}"The title and message fields support Go template variables. Available variables include:
Build Variables:
{{build.status}}- Build status (success/failure){{build.number}}- Build number{{build.event}}- Build event type{{build.link}}- Link to the build{{build.tag}}- Git tag (if applicable)
Repository Variables:
{{repo.name}}- Repository name{{repo.namespace}}- Repository namespace/organization{{repo.full_name}}- Full repository name (owner/repo)
Commit Variables:
{{commit.message}}- Commit message{{commit.author}}- Commit author{{commit.sha}}- Commit SHA{{commit.ref}}- Commit reference{{commit.branch}}- Branch name
Configure the plugin using environment variables. When running in Docker containers, these should be set as PLUGIN_* variables:
| Variable | Required | Default | Description |
|---|---|---|---|
PLUGIN_URL |
β Yes | β | Gotify server URL (e.g., https://my-gotify-instance:8081) |
PLUGIN_TOKEN |
β Yes | β | Gotify app token for authentication |
PLUGIN_TITLE |
No | Drone CI |
Notification title (supports template variables) |
PLUGIN_MESSAGE |
No | β | Notification body (supports template variables) |
PLUGIN_PRIORITY |
No | 5 |
Message priority (1-10, higher = more critical) |
PLUGIN_MARKDOWN |
No | false |
Render message as Markdown in Gotify clients (true/false) |
PLUGIN_CLICK_URL |
No | β | URL to open when notification is clicked (supports template variables) |
PLUGIN_ENV_FILE |
No | .env |
Path to custom env file to load at startup |
When running locally, create a .env file in the project root:
PLUGIN_URL=https://my-gotify-instance:8081
PLUGIN_TOKEN=my-app-token
PLUGIN_TITLE="Build {{build.number}} - {{repo.name}}"
PLUGIN_MESSAGE="Status: {{build.status}}\nAuthor: {{commit.author}}"
PLUGIN_PRIORITY=5
PLUGIN_MARKDOWN=true
PLUGIN_CLICK_URL=https://drone.example.com/{{repo.owner}}/{{repo.name}}/{{build.number}}services:
drone-gotify:
image: dipievil/drone-gotify
environment:
PLUGIN_URL: https://my-gotify-instance:8081
PLUGIN_TOKEN: my-app-token
PLUGIN_PRIORITY: "8"
PLUGIN_MARKDOWN: "true"Problem: The plugin cannot connect to your Gotify instance.
Solutions:
- Verify the
PLUGIN_URLis correct and reachable from your Drone runner - Check that the Gotify server is running:
curl https://my-gotify-instance:8081 - For local development, ensure the Docker container can access your Gotify instance network
- Check firewall rules and network policies
Problem: Authentication with Gotify failed.
Solutions:
- Verify the
PLUGIN_TOKENis a valid Gotify app token - Create a new app token in Gotify admin panel if token has expired
- Ensure the token is not accidentally truncated or modified
Problem: Plugin runs without errors but notification doesn't appear.
Solutions:
- Check Gotify server logs for received messages
- Verify
PLUGIN_URLandPLUGIN_TOKENare set correctly - Enable debug logging if available
- Verify the notification didn't go to a different client/channel
Problem: Variables like {{build.number}} appear as literal text.
Solutions:
- Ensure you're using double curly braces
{{variable}} - Check the variable name matches the list in Template Variables section
- Verify template is in
titleormessagefield, not in other settings
Problem: Plugin fails to connect when Drone runs on a Docker network.
Solutions:
- Use the Gotify container name instead of
localhost:http://gotify-container:8080 - Ensure both containers are on the same Docker network
- Use
host.docker.internalfor host machine access on Docker Desktop
- Go 1.22 or higher
- Make
- Docker (for building container image)
# Clone repository
git clone https://github.com/dipievil/drone-gotify.git
cd drone-gotify
# Install dependencies
make tidy
# Build binary
make build
# Run tests
make test
# Run the plugin locally
make rungo test -v -cover ./...Contributions are welcome! Please follow these guidelines:
-
Fork the repository and create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes and ensure tests pass
make test -
Follow conventional commits for commit messages
feat:for new featuresfix:for bug fixesdocs:for documentationtest:for testschore:for maintenance
-
Create a pull request with a clear description of your changes
- Follow Go conventions and best practices
- Use
gofmtfor code formatting - Run tests before submitting a PR
- Update README if adding new features
Please report issues with:
- Clear title describing the problem
- Steps to reproduce
- Expected vs actual behavior
- Environment details (Drone version, Go version, etc.)
- Any error messages or logs
This project is licensed under the Apache License 2.0. See LICENSE file for details.
- Gotify - Simple server for sending and receiving messages
- Drone CI - The leading open-source continuous integration platform
- urfave/cli - A simple, fast, and fun package for building command line apps in Go
- godotenv - A Go port of the Ruby dotenv project
- drone-telegram - A Drone plugin for sending notifications to Telegram
Questions or Issues? Create an issue on GitHub!