Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add doc on notification in yaml files #5110

Merged
merged 2 commits into from
Apr 7, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`
sguiheux marked this conversation as resolved.
Show resolved Hide resolved
send_to_groups: true
recipients:
- [email protected]
conditions:
check:
- variable: cds.triggered_by.email
operator: eq
value: [email protected]
sguiheux marked this conversation as resolved.
Show resolved Hide resolved
```

Example of vcs notification. Note that `pipelines` list is optionnal on every notifications. When it's not specified, notification will be triggered for each pipeline
sguiheux marked this conversation as resolved.
Show resolved Hide resolved

```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
```