'GitLab pipeline rules:exists with more than 10000 files in repo

I am using a template for my CI/CD on GitLab. I want to enable some jobs only for repositories with specific files. I try to use rules:exists:

rules:
  - exists:
      - Src/*/ApiTests/*.json

But my repositories contain more than 10000 files and GitLab has a restriction:

For performance reasons, GitLab matches a maximum of 10,000 exists patterns or file paths. After the 10,000th check, rules with patterned globs always match. In other words, the exists rule always assumes a match in projects with more than 10,000 files.

I can make checks on before_script, but I want to hide this job from the pipeline.

Currently running Gitlab-EE 13.3.9

Any help is much appreciated! Thanks in advance!



Solution 1:[1]

I think you answered yourself, I see as only workaround to do the check in the before_script and set a variable that you will check in the rules + if.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Danilo Cacace