Parallelism

Updated 2 years ago by Admin

Pipeline steps are executed sequentially by default. You can optionally describe your build steps as a directed acyclic graph. In the below example we fan-out to execute the first two steps in parallel, and then once complete, we fan-in to execute the final step:

1  kind: pipeline
2 type: digitalocean
3 name: default
4
5 token:
6 from_secret: token
7
8 steps:
9 - name: backend
10 commands:
11 - go build
12 - go test
13
14 - name: frontend
15 image: node
16 commands:
17 - npm install
18 - npm test
19
20 - name: publish
21 commands:
22 - docker build -t hello-world .
23 - docker push hello-world
24 depends_on:
25 - frontend
26 - backend

The above example is quite simple, however, you can use this syntax to create very complex execution flows.

Note that when you define the dependency graph you must configure dependencies for all pipeline steps.
Note that you can use conditional steps in your dependency graph. The scheduler automatically corrects the dependency graph for skipped steps.


How did we do?