Fix CI detection of GitLab and GitLab FOSS projects

Merged Rémy Coutable requested to merge fix-ci-gitlab-and-foss-projects-detection into master

What does this MR do?

This fixes a regression introduced by !17354 (merged) that disabled EE-specific jobs for dev and forks that haven't been renamed.

This also updates the checks for the GitLab project across the project. I've also improved the detection of the FOSS project as well.

This also addresses part of #32374 (closed).

Edited by Rémy Coutable