CI/CD

How to create dependencies between jobs so one job runs after another?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

Using the "needs" attribute/directive.

jobs:
  job1:
  job2:
    needs: job1

In the above example, job1 must complete successfully before job2 runs