Frontend: Circular includes in pipeline config no longer being detected correctly by validator, 500 error when committing changes to `.gitlab-ci.yml` via repo editor

Summary

When a pipeline is configured such that .gitlab-ci.yml includes file1.yml which includes file2.yml which includes file1.yml (i.e. a circular reference) no message is displayed in the CI/CD Editor indicating the same file has been included twice. Instead a "Configuration validation currently not available." message is displayed.

In earlier versions (e.g. 14.6.5) a message like "This GitLab CI configuration is invalid: Include {"local":"file1.yml"} was already included!" was displayed.

Additionally, when you edit the .gitlab-ci.yml file via the Repository file editor a 500 error is generated upon committing the change.

Steps to reproduce

  1. Create a new project cicd-circular
  2. Create a file file1.yml:
include:
  - file2.yml
  1. Create a file file2.yml:
include:
  - file1.yml
  1. Create a file .gitlab-ci.yml:
include:
  - file1.yml
  1. Go to CI/CD Editor. Note after a period of time the message "Configuration validation currently not available." is displayed.
  2. Go to Repository, Files, click on .gitlab-ci.yml and then click on Edit. Make a minor change and click Commit Changes. After a period a 500 error is displayed.

Implementation Table

Group Issue Link
backend Backend: Circular includes in pipeline config n... (#385360 - closed)
frontend 👈 You are here
documentation Documentation: Update docs to reflect proper me... (#369382 - closed)

Example Project

https://gitlab.com/jfarmiloe/cicd-circular

What is the current bug behavior?

Repository file editor and CI/CD Validator break when faced with circular include statements in pipeline config.

What is the expected correct behavior?

frontend A useful message should be displayed in the CI/CD Editor page indicating a circular reference has been detected.

Unable to validate CI/CD configuration. See the \[GitLab CI/CD troubleshooting guide\](https://docs.gitlab.com/ee/ci/troubleshooting.html#common-cicd-issues) for more details.

backend Changes made to the .gitlab-ci.yml file via the Repository file editor should commit without error.

Relevant logs and/or screenshots

Version 14.6.5 CI/CD Editor page:

version 14.6.5 CI/CD Editor page

GitLab.com CI/CD Editor page:

gitlab.com CI/CD Editor page

Output of checks

This bug happens on GitLab.com.

Possible fixes

Edited by Leaminn Ma