Evaluate rules once for parallel jobs
Problem
Rules are expensive to parse and evaluate and even more expensive for parallel jobs where we transform the numbers into specific jobs. The current execution path is:
- Process the YAML files into a big Hash structure
- Process the Hash in the normalizer class to expand parallel job definitions into the actual jobs
- Evaluate the rules for each job to determine if it should be created or not.
Proposal
Because parallel jobs share the same rules, we should be able to evaluate them once, cache and share the result across all the jobs from the pipeline that's being created.
Risks
If someone uses the variables exposed by the parallel config (like CI_NODE_INDEX
), the rules result could return a wrong value, but why would anyone do that?