Optimize `**/*.EXT` to use `end_with?('.EXT')` over slow `fnmatch?`
What does this MR do and why?
This MR implements an optimization for CI's rules.exists
clause **/*.EXT
.
Given this example:
eslint-sast:
extends: .sast-analyzer
rules:
- if: $CI_COMMIT_BRANCH
exists:
- '**/*.html'
- '**/*.js'
For large repositories (> 10k files) this clause would always match if the amount of (slow) comparisons (via fnmatch?
) would exceed 10k.
Instead of increasing MAX_PATTERN_COMPARISON
(#227632) we can use the much faster (24x) end_with?
operation.
To protect GitLab.com this optimization is behind a feature flag. See gitlab-com/gl-infra/production#17531 (closed).
Draft?
-
Test this performance optimization behind a feature flag or similar -
Adjust documentation- No documentation required. See https://docs.gitlab.com/ee/development/feature_flags/#gitlab_com_derisk-type
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
TBD.
Edited by Peter Leitzen