A structured and opinionated Slack notification resource for Concourse. It started as a rewrite of arbourd/concourse-slack-alert-resource in Rust to add a few features, mainly reading the message from a file or being able to send shorter messages that still had a similar format.
The message is built by using Concourse's resource metadata to show the pipeline, job, build number and a URL.
Use this resource by adding the following to the resource_types section of a pipeline config:
resource_types:
- name: slack-notifier
type: docker-image
source:
repository: mockersf/concourse-slack-notifier
See the Concourse docs for more details on adding resource_types
to a pipeline config.
url
: Required. Slack webhook URL.channel
: Optional. Target channel where messages are posted. If unset the default channel of the webhook is used.concourse_url
: Optional. The external URL that points to Concourse. Defaults to the env variableATC_EXTERNAL_URL
.username
: Optional. Concourse local user (or basic auth) username. Required for non-public pipelines if using alert typefixed
orbroke
password
: Optional. Concourse local user (or basic auth) password. Required for non-public pipelines if using alert typefixed
orbroke
ca_cert
: Optional. A CA certificate for the Concourse instance. This is used to validate the certificate of Concourse when the instance's certificate is signed by a custom authority (or itself).ignore_ssl
: Optional. This option allows unsecure access to Concourse (not verifying certificates).disabled
: Optional. This option will disable all notifications from this resource.
resources:
- name: notify
type: slack-notifier
source:
url: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
Sends a structured message to Slack based on the alert type and mode.
alert_type
: Optional. The type of alert to send to Slack. See Alert Types. Defaults tocustom
.channel
: Optional. Channel where this message is posted. Defaults to thechannel
setting in Source.message
: Optional. The status message at the top of the alert. Defaults to name of alert type.message_file
: Optional. The path to a file to use as message.fail_if_message_file_missing
: Optional. Will fail ifmessage_file
is set but the file is missing. Defaults tofalse
.color
: Optional. The color of the notification bar as a hexadecimal. Defaults to the icon color of the alert type.mode
: Optional. The amount of information displayed in the message. See Modes. Defaults tonormal_with_info
.disabled
: Optional. This notification is disabled.message_as_code
: Optional. Message text will be wrapped in``` [...] ```
, if message is in modenormal
ornormal_with_info
.
basic configuration:
jobs:
plan:
- put: notify
with an alert type, a mode and a message
jobs:
plan:
- put: notify
params:
message: my job failed
mode: concise
alert_type: failed
-
custom
-
success
-
failed
-
started
-
aborted
-
fixed
Fixed is a special alert type that only alerts if the previous build did not succeed. Fixed requires
username
andpassword
to be set for the resource if the pipeline is not public. -
broke
Broke is a special alert type that only alerts if the previous build succeed. Broke requires
username
andpassword
to be set for the resource if the pipeline is not public.
Examples notifications with a messages with the different modes: