Workflows
The workflows
section lists CI/CD workflows.
A workflow helps you organize tasks related to a certain CI/CD stage into a logical sequence.
For example, a single workflow may run for builds, tests, linting, code coverage verification, etc. All these steps will be different tasks as part of such a workflow. Then, you may have another workflow to generate documentation and deploy the new version to production.
All workflows are run concurrently.
Supported properties:
tasks
: List of tasks that are part of the workflow.settings
: Settings valid for the entire workflow.runs_on
: Type of worker on which the workflow tasks will run. The possible values are:compute
: Cloud worker. This is a default value.serverless
: Serverless worker. See these examples.self-hosted
: Self-hosted worker. You can also specify a tag in this parameter; see here for an example.
settings
The settings
section specifies the settings that are valid for the entire workflow, for example:
workflows:
my-workflow:
settings:
max_cube_duration: 20s
retry: 2
Example of a workflow with two tasks configured differently
One workflow task is within the workflows
section, the other is outside it. my-task
is an example of using cube dependencies; for more info, see Cubes.
tasks:
- name: another-task
cubes:
- name: D
script:
- echo It's another task.
workflows:
my-workflow:
tasks:
- name: my-task
cubes:
- name: A
script:
- touch test.txt
- name: B
needs: ['-']
script:
- rm -f test.txt
- name: C
needs: ['A', 'B']
script:
- ls
- another-task
...
Example of two different workflows run depending on the event type
on:
pull_request:
- workflows: workflow-for-pr
filter:
source_branches: ["**", "!test**"]
target_branches: "main"
push:
- workflows: workflow-for-push
filter:
branches: ["main"]
workflows:
workflow-for-pr:
tasks:
- name: sample-task-1
cubes:
- name: sample-cube1
image: docker.io/library/node
script:
- echo Hello, world!
workflow-for-push:
tasks:
- name: sample-task-2
cubes:
- name: sample-cube2
script:
- echo Test, and deploy your project.
See also
Was the article helpful?
Previous
Next