Pipeline "Job dependencies" is not showing for optional needs

Summary

When some job optionally needs a job which is not included into pipeline (e.g. excluded via rules), the pipeline "Job dependencies" fails to render.

Steps to reproduce

  • have 2 stages and 3 jobs like this
# .gitlab-ci.yml

stages:
- foo
- bar

foo1:
  stage: foo
  script:
    - echo "===Foo1 job"

foo2:
  stage: foo
  script:
    - echo "===Foo2 job"
  rules:
    - when: never

bar:
  stage: bar
  needs:
    - job: foo1
      optional: true
    - job: foo2
      optional: true
  script:
    - echo "===Bar job"
  • run the pipeline with given gitlab-ci.yml

Example Project

N/A (Please see .gitlab-ci.yml example above)

What is the current bug behavior?

The pipeline "Job dependencies" is not being rendered and stuck with loading indicator.

What is the expected correct behavior?

  • The pipeine is shown
  • A proper graph is shown in "Job dependencies" view

Relevant logs and/or screenshots

N/A

Output of checks

N/A

Results of GitLab environment info

Expand for output related to GitLab environment info
GitLab Enterprise Edition 13.12.9-ee

Results of GitLab application Check

N/A

Possible fixes

N/A