Skip to content

Commit

Permalink
feat(docs): add doc on notification in yaml files (#5110)
Browse files Browse the repository at this point in the history
  • Loading branch information
sguiheux authored Apr 7, 2020
1 parent 2e8a66c commit e671a3d
Showing 1 changed file with 57 additions and 2 deletions.
59 changes: 57 additions & 2 deletions docs/content/docs/concepts/files/workflow-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ workflow:
hooks:
build:
- type: RepositoryWebHook
notifications:
- type: email
pipelines:
- deploy
settings:
on_success: never
recipients:
- [email protected]
```
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.

## Run Conditions

[Run Conditions documentation]({{ <relref "/docs/concepts/workflow/run-conditions.md">}})
[Run Conditions documentation]({{<relref "/docs/concepts/workflow/run-conditions.md">}})

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

Expand Down Expand Up @@ -71,3 +78,51 @@ Example with using LUA syntax as advanced condition:
script: return cds_manual == "true" or (cds_status == "Success" and git_branch
== "master" and git_repository == "ovh/cds")
```

## Notifications

[Notifications documentation]({{<relref "/docs/concepts/workflow/notifications.md">}})

Example of email notification.

```yml
- type: email
pipelines:
- deploy
settings:
on_success: never
recipients:
- [email protected]
```

Example of jabber notification. Note that you can add `conditions` on every notifications

```yml
- type: jabber
pipelines:
- deploy
settings:
on_start: true
send_to_groups: true
recipients:
- [email protected]
conditions:
check:
- variable: cds.triggered_by.email
operator: eq
value: [email protected]
```

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

```yml
- type: vcs
settings:
template:
body: |+
[[- if .Stages ]]
CDS Report [[.WorkflowNodeName]]#[[.Number]].[[.SubNumber]] [[ if eq .Status "Success" -]] ✔ [[ else ]][[ if eq .Status "Fail" -]] ✘ [[ else ]][[ if eq .Status "Stopped" -]] ■ [[ else ]]- [[ end ]] [[ end ]] [[ end ]]
[[- end]]
disable_comment: false
disable_status: false
```

0 comments on commit e671a3d

Please sign in to comment.