CI trigger on file changes *except*

Summary

The problem is that it seems impossible to exclude certain directories or files from glob patterns when specifying how to trigger a job.

Say I have a repo like this:

- a
- b
- c
- shared/
    - ab
    - ac
    - bc

This repo has three separate projects (a, b, c), but some shared code between each of the projects (for example shared/ac is code shared between projects a and c).

I want to setup CI so that if a file changes in a, shared/ac, or shared/ab, it triggers build_a.

Of course, I could specify the following paths:

  • a/**/*
  • shared/ac/**/*
  • shared/ab/**/*

But this does not scale very well as the number of shared subdirectories grows. I would instead like to specify something like:

  • a/**/*
  • 'shared/!(bc/)**/*'

Also, I have no idea if inverse globs are even supported because I can't find GitLab globbing documentation. Where is supported glob format for changes section of yml documented? I can only find token examples, no complete documentation.

Related Issues:

Possible fixes

If GitLab can't provide this functionality, let me run my own script to determine whether a job should run or not based on the return code of the script and I could easily just write a python script that uses python's globbing power.

Edited by Bryan Gillespie