Pipeline configuration file

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

version: v1.0
name: build

parameters:
  param_name:
    type: string
    default: default_value
    
stages:
- Compile
- Package


jobs:
- job: Build UI
  stage: Compile
  steps:
  - gitClone:
      branch: '{{.git.branch}}'
      commit: '{{.git.hash}}'
      directory: cds
      url: '{{.git.url}}'
  - script:
    - echo {{.cds.pip.param_name}}  
    - cd cds/ui
    - npm set registry https://registry.npmjs.org
    - npm install
    - ng build -prod --aot
    - tar cfz ui.tar.gz dist
  - artifactUpload:
      path: cds/ui/ui.tar.gz
      tag: '{{.cds.version}}'
  requirements:
  - binary: git
  - memory: "1024"
  - model: Node8.9.1

- job: Test UI
  stage: Compile
  enabled: false
  requirements:
  - binary: git
  - memory: "1024"
  - model: Node8.9.1

  steps:
  - gitClone:
      branch: '{{.cdsbuildgitbranch}}'
      commit: '{{.git.hash}}'
      directory: cds
      password: ""
      privateKey: ""
      url: '{{.cds.app.repo}}'
      user: ""
  - script:
    - export CHROME_BIN=chromium
    - npm set registry https://registry.npmjs.org
    - cd cds/ui
    - npm install
    - npm test

  - jUnitReport: ./cds/ui/tests/**/results.xml

- job: Package UI
  stage: Package
  requirements:
  - binary: docker
  steps:
  - artifactDownload:
      path: .

  - CDS_DockerPackage:
      dockerfileDirectory: .
      imageName: ovh/cds-ui
      imageTag: '{{.cds.version}}'
  

Stages

This file describes three jobs (Build UI, Test UI and Package UI) in two stages Compile and Package. The two first jobs will be run in parallel in the first stage. When the first Stage is successful, the second stage containing the last job will be run.

A pipeline always begins with:

version: v1.0
name: build
stages:
- Compile
- Package

where:

Jobs

Each job has several properties:

Steps

Each job is composed of steps. A step is an action performed by a CDS Worker within a workspace. Each step uses an action and the syntax is:

- job: xxx
  steps:
  - myAction: myParameter
- job: xxx
  steps:
  - myAction: 
      myFistParameter: value
      mySecondParameter: value

Read more about available actions.

Optional

It is possible to make a step optional. Even if this task fail the job will continue.

- job: xxx
  steps:
  - myAction: 
      myFistParameter: value
      mySecondParameter: value
    optional: true

This also work for built-in action

- job: xxx
  steps:
  - coverage:
      format: other
      path: "{{.cds.workspace}}/target/site/jacoco/jacoco.xml"
    optional: true