CI rules if:exists to AND multiple files instead of OR
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Proposal
The customer has use cases requiring different jobs for a tool based on different combinations of files present in the repository.
The impact is what the customer perceives as increased complexity in their GitLab CI implementations. In the particular use case, the customer was trying to setup jobs to run Goss tests if there is a goss.yaml file present. But they also have a special wrappers for Docker (dgoss) and Kubernetes (kgoss). So they wanted to have separate jobs to run those tools based on secondary files (ie if both Dockerfile and goss.yaml exist, then run the dgoss job instead of the goss job). These individual jobs could be logically declared in the same template that defines the rest of the jobs that activate on the same file (such as a single template defining all jobs that activate on a Dockerfile). So instead they would have to have a single job with an assortment of if statements in the script to inspect the project dir and respond accordingly. And that single job would have to be in a separate file from all the other jobs that act on a Dockerfile being present.
Relevant forum discussion: https://forum.gitlab.com/t/using-rules-exists-to-check-if-multiple-files-exists-at-the-same-time/51697/5