Skip to content
Snippets Groups Projects
Gaëtan Blond's avatar
e785d611
History

Updates Notifier

Sends an email and a message in Mattermost to alert when new versions of tools are available.

Initial credit goes to Romain De Laage.

How to install dependencies

  1. Install and configure poetry if you don’t have it already :

    curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
  2. Navigate to this folder and run poetry install in your shell. It should create a virtualenv and install all dependencies in it. To activate the virtualenv, run poetry shell.

Note that this project requires at least Python 3.10, but may work with older versions by adjusting the dependencies' version.

How to use

$ notify-updates.py --help
Usage: notify-updates.py [OPTIONS] FEEDS_CFG DB_PATH

  FEEDS_CFG:  Path to the YAML file containing the feeds' parameters
  DB_PATH: Path to the SQLite3 database file

Options:
  -d, --dry-run    Search for new updates, but no db updates or
                   notifications
  -v, --verbose    Toggle debug output
  --no-email       Do not send email
  --no-mattermost  Do not send a Mattermost message
  --help           Show this message and exit.

You will also need to setup the following environment variables :

Name Description
MAIL_HOST SMTP server host
MAIL_PORT SMTP server port
MAIL_USER SMTP user
MAIL_PASSWORD SMTP password associated to $MAIL_USER
MAIL_SUBJECT Subject of the notification email
MAIL_TO Recipients of the notification email
MAIL_FROM Sender of the notification email
MM_SERVER_HOST Mattermost server hostname
MM_CHANNEL_ID Mattermost channel ID where to send the notification
MM_TOKEN Mattermost access token

A working example of configuration is available in this repository.

How to build the Python wheel

Simply run poetry build. The standard wheel with an auto-generated old-school setup.py is then available in the dist/ folder.