Job dependencies


Job dependencies 1/

needs can start jobs from the next stage early…

job1:
  stage: stage1
  #...
job2:
  stage: stage2
  needs: job1
  #...

…or delay them in the same stage

job1:
  stage: test
  #...
job2:
  stage: test
  needs: job1
  #...

Job dependencies 2/2

Depend on a job but do not consume artifacts :

job_name:
  #...

job_name2:
  needs:
    job: job_name
    artifacts: false

Consume artifacts from parent (upstream) pipeline :

job_name:
  script: cat artifact.txt
  needs:
    - pipeline: $PARENT_PIPELINE_ID
      job: create-artifact

Hands-On

See chapter Job dependencies