FanteG
FanteG

Reputation: 383

Subsequent jobs in gitlab-ci

Is there any way to run jobs from the stage in subsequent order? I've tried to do it with dependecies

job1:
    stage:deploy
...
job2:
    stage:deploy
dependencies:
    - job1

but it gives me an error "dependency job1 is not defined in prior stages". Is there any workaround?

Upvotes: 27

Views: 22511

Answers (3)

Sushil.R
Sushil.R

Reputation: 127

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

Upvotes: 4

Klaas van Schelven
Klaas van Schelven

Reputation: 2528

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

Upvotes: 4

Stefan van Gastel
Stefan van Gastel

Reputation: 4478

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.

Upvotes: 29

Related Questions