Workflow configuration file

A CDS workflow file only contains the description of pipelines orchestration, hooks, run conditions, etc. Consider the following workflow wich implements a basic two-stage workflow:

name: my-workflow
workflow:
  build:
    pipeline: build
    application: my-application
  deploy:
    depends_on:
    - build
    when:
    - success
    pipeline: deploy
    application: my-application
    environment: my-production
    one_at_a_time: true
hooks:
  build:
  - type: RepositoryWebHook
integrations:
  my-artifactory-integration-name:
    type: artifact_manager
notifications:
- type: email
  pipelines:
  - deploy
  settings:
    on_success: never
    recipients:
    - me@foo.bar
retention_policy: return run_days_before < 7

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

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

yourpipeline:
  depends_on:
  - theparentpipeline
  conditions:
    check:
    - variable: git.branch
      operator: ne
      value: master
  when:
  - success

Example with many checks:

conditions:
  check:
  - variable: git.branch
    operator: eq
    value: master
  - variable: git.repository
    operator: eq
    value: ovh/cds
  when:
  - success

Example with using LUA syntax as advanced condition:

  conditions:
    script: return cds_manual == "true" or (cds_status == "Success" and git_branch
      == "master" and git_repository == "ovh/cds")

Integrations

Artifactory Integration

Notifications

Notifications documentation

Example of email notification.

- type: email
  pipelines:
  - deploy
  settings:
    on_success: never
    recipients:
    - me@foo.bar

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

- 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

Mutex

Mutex documentation

Example of a pipeline limited to one execution at a time: deployments to production cannot be executed concurently.

name: my-workflow
workflow:
  # ...
  deploy:
    pipeline: deploy
    # ...
    one_at_a_time: true # No concurent deployments

Retention Policy

Retention documentation