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:
- env files with key-value pairs ie.
-e production.env
or--env-file=staging.env
- json files ie.
-j terraform-output.json
or--env-file=infrastructure.json
- key-value pairs provided as command arguments ie.
-v env_name=jupiter
or--var instance_type=small
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file Simple Slack Send-0.1.2.tar.gz
.
File metadata
- Download URL: Simple Slack Send-0.1.2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed919c84ab97889a0d9f1c011a391caa10e17c5b59b9c2b308d756b50e6f5703 |
|
MD5 | 9019b6540fffbcafba66be47c8f6ee11 |
|
BLAKE2b-256 | 1ae8012863cc1f062c0cea2b5b96e6192ea1b278003288a55b370a7770754171 |
File details
Details for the file Simple_Slack_Send-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: Simple_Slack_Send-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bf4d152db21038b976a49b993b9a682dd600a93a160c77e9c14deaf3a21dd67 |
|
MD5 | 6536eefb2c846bd9a99cb98481ba0635 |
|
BLAKE2b-256 | c6c60d889f3989dc25334674504059295b666a419671ff060af6fc1369f3d71d |