Backend: Nested includes does not work for remote includes

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

When a remote include has a local include, it does not work.

Steps to reproduce

.gitlab-ci.yml;

include:
  - https://example.xyz/a.yml

https://example.xyz/a.yml;

include:
  - local: b.yml

What is the current bug behavior?

The nested local include won't load:

This GitLab CI configuration is invalid: Local file `b.yml` does not have project!.

Further explanation

When you include a remote file (remote: 'https://example.xyz/a.yml'): if that remote file includes other files, we do not merge a.yml directly; first, we try to expand included files within the context of a.yml, which is empty. So, we do not detect included files if those are local, project, etc.

Proposed solution

We should consider merging the included files in remote files instead of expanding them.

Edited by 🤖 GitLab Bot 🤖