Subsequent jobs in gitlab-ci

You might have found out the answer by now, but still answering for future audiences coming to post when facing similar issue.

The error itself says "dependency job1 is not defined in prior stages", in your example both jobs having same name i.e "stage: deploy".

so that is the reason its not picking up the dependencies rule, also with new gitlab version, need clause can be used now.

Job1:
  Stage: A
Job2:
  Stage: B
  needs: ["Job1"] 

This way, Job2 will get dependent on Job1


It might become possible at some point in the future (as of January 2021). Progress is being tracked here


No. This is not possible by design. You will have to define more stages.

As the stages docs describe:

  1. Jobs of the same stage are run in parallel.

Tags:

Gitlab Ci