Skip to content

Commit e671a3d

Browse files
authored
feat(docs): add doc on notification in yaml files (#5110)
1 parent 2e8a66c commit e671a3d

File tree

1 file changed

+57
-2
lines changed

1 file changed

+57
-2
lines changed

docs/content/docs/concepts/files/workflow-syntax.md

+57-2
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,20 @@ workflow:
2626
hooks:
2727
build:
2828
- type: RepositoryWebHook
29+
notifications:
30+
- type: email
31+
pipelines:
32+
- deploy
33+
settings:
34+
on_success: never
35+
recipients:
36+
2937
```
3038
3139
There are two major things to understand: `workflow` and `hooks`. A workflow is a kind of graph starting from a root pipeline, and other pipelines with dependencies. In this example, the `deploy` pipeline will be triggered after the `build` pipeline.
3240

3341
## Run Conditions
34-
35-
[Run Conditions documentation]({{ <relref "/docs/concepts/workflow/run-conditions.md">}})
42+
[Run Conditions documentation]({{<relref "/docs/concepts/workflow/run-conditions.md">}})
3643

3744
Example of basic condition. Notice that the `when` attribute is optional, it's just a shortcut on condition `cds.status == Success`.
3845

@@ -71,3 +78,51 @@ Example with using LUA syntax as advanced condition:
7178
script: return cds_manual == "true" or (cds_status == "Success" and git_branch
7279
== "master" and git_repository == "ovh/cds")
7380
```
81+
82+
## Notifications
83+
84+
[Notifications documentation]({{<relref "/docs/concepts/workflow/notifications.md">}})
85+
86+
Example of email notification.
87+
88+
```yml
89+
- type: email
90+
pipelines:
91+
- deploy
92+
settings:
93+
on_success: never
94+
recipients:
95+
96+
```
97+
98+
Example of jabber notification. Note that you can add `conditions` on every notifications
99+
100+
```yml
101+
- type: jabber
102+
pipelines:
103+
- deploy
104+
settings:
105+
on_start: true
106+
send_to_groups: true
107+
recipients:
108+
109+
conditions:
110+
check:
111+
- variable: cds.triggered_by.email
112+
operator: eq
113+
114+
```
115+
116+
Example of vcs notification. Note that `pipelines` list is optional on every notifications. When it's not specified, notification will be triggered for each pipeline
117+
118+
```yml
119+
- type: vcs
120+
settings:
121+
template:
122+
body: |+
123+
[[- if .Stages ]]
124+
CDS Report [[.WorkflowNodeName]]#[[.Number]].[[.SubNumber]] [[ if eq .Status "Success" -]] ✔ [[ else ]][[ if eq .Status "Fail" -]] ✘ [[ else ]][[ if eq .Status "Stopped" -]] ■ [[ else ]]- [[ end ]] [[ end ]] [[ end ]]
125+
[[- end]]
126+
disable_comment: false
127+
disable_status: false
128+
```

0 commit comments

Comments
 (0)