# Generate notifications, using Cycloid events as example
Most of our customers ask to send notifications for pipeline status on Slack, Github, etc.
Pipelines are really flexible and lot of functionalities can be added by resources. The best approach to send notifications is to use resources. You can integrate any notification type by using existing resource or by creating your own.
Let's use Cycloid events as example of notification.
Before using events, we advise you to create a dedicated Cycloid's user and put its credential into Cycloid credential section. In our case, we will create a dedicated user called Cyclobot and add the account as a basic_auth
typed credential named basic_auth_cyclobot-account
with username
and password
as fields:
As well, you already know the next step. If we want to keep our pipeline generic, let's define new variables for the API URL and the user to use in pipeline variables.
Follow those steps to apply all changes described in this step
stack-sample/pipeline/variables.sample.yml
# Cycloid events configuration
api_login: ((basic_auth_cyclobot-account.username))
api_password: ((basic_auth_cyclobot-account.password))
api_url: https://http-api.cycloid.io
2
3
4
At this point, we are ready to configure a new cycloid-events
resource in the pipeline and use it in our job.
stack-sample/pipeline/pipeline.yml
resource_types:
...
- name: cycloid-events
type: docker-image
source:
repository: cycloid/cycloid-events-resource
resources:
...
- name: cycloid-events
type: cycloid-events
source:
api_login: ((api_login))
api_password: ((api_password))
api_url: ((api_url))
icon: fa-code-branch
organization: ((customer))
severity: info
type: Custom
tags:
- key: project
value: ((project))
- key: env
value: ((env))
- key: customer
value: ((customer))
jobs:
...
- name: functional-tests
plan:
- do:
...
on_failure:
do:
- put: cycloid-events
params:
severity: crit
message: Oops
title: The deployment of ((project)) owl have failed on ((env)) environment
on_success:
do:
- put: cycloid-events
params:
message: Congrats !
title: Successful deployment of ((project)) owl on ((env)) environment
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
First define a new type of resource cycloid-events
and configure it in the resources
section. Finally add a pipeline step hook for success and failure which call the cycloid-events
resource.
Add and commit those changes in Git:
git add .
git commit -m "Step 7"
git push origin stacks
2
3
Get back to Cycloid's dashboard, click on the Refresh pipeline
button .
After running the pipeline, a new Cycloid event should be visible on the event view: