Skip to main content

Simple Slack Send - send Slack notifications in CI pipelines

Project description

Simple Slack Send - easily send slack messages in your CI pipelines

Simple Slack Send is designed to push templated slack notifications from you CI pipelines using Slack's incoming webhooks.

Template engine

Simple Slack Send uses Jinja2 under the hood to produce Slack messages in JSON format. You can use any expression (values, includes, conditions, loops etc.) that is allowed by Jinja. If the rendering engine's output is empty, no message is sent.

Parameter sources

Jinja templates are fed with values from multiple sources given as command arguments:

  1. env files with key-value pairs ie. -e production.env or --env-file=staging.env
  2. json files ie. -j terraform-output.json or --env-file=infrastructure.json
  3. key-value pairs provided as command arguments ie. -v env_name=jupiter or --var instance_type=small
  4. system environment - turned on/off with --sys-env/--no-sys-env option; on by default

Configuration

You can pass Slack's webhook url by settings SLACK_WEBHOOK_URL env variable or using --webhook-url argument.

Example usage

message.json.tpl:

{% if BITBUCKET_EXIT_CODE == "0" %}
{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": ":large_green_circle: Commit {{ BITBUCKET_COMMIT }} built successfully."
      }
    }
  ]
}
{% else %}
{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": ":red_circle: Commit {{ BITBUCKET_COMMIT }} failed to build. Visit <https://bitbucket.org/{{ BITBUCKET_REPO_FULL_NAME }}/pipelines/results/{{ BITBUCKET_BUILD_NUMBER }}|pipeline> for details."
      }
    }
  ]
}
{% endif %}
simple-slack-send message.json.tpl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Simple Slack Send-0.1.1.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Simple_Slack_Send-0.1.1-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file Simple Slack Send-0.1.1.tar.gz.

File metadata

  • Download URL: Simple Slack Send-0.1.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for Simple Slack Send-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4bf14990417495d8f72ebd8641995facbccd9c20870eb8ef0bbb9fefe621d1c7
MD5 dcb60eaca5dde2d8503f4d1cb3797b31
BLAKE2b-256 258db3f7391672d6d7e5f1630f94501fcf70ce0c82177904217ec392b3593aea

See more details on using hashes here.

File details

Details for the file Simple_Slack_Send-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Simple_Slack_Send-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7eb81fd06defe6007851c74f606b6fba3f4eb101ada57ec2ffcf1ca68bdca7ec
MD5 b4f7b58a0d59eef3837f57b80d67dcc9
BLAKE2b-256 e48afde8a18fe2b2ce3548674cdc102e2c70c3e4c63720153b89811c6740ebe0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page