dynamic ci jobs based on globs
Description
Monorepos offers many benefits. Status quo excludes monorepos microservices because the line is drawn at one repo per lifecycle. This can be somewhat over come with some bash script fu... but just somewhat. An exaple of a wrapper script is Lolaus, a poc I started today and will be developing to for actual use.
This proposal allows dynamic jobs based on globs - this would be a prime ci service differentiation and eliminate the needs the wrapper scripts.
Proposal
Lets looks at some examples to see just what in the world I am talking about. Here is a Makefile that builds multiple docker images from one build rule definition. Think of the Makefile as .gitlab-ci.yml, the folders containing Dockerfiles as folders containing microservices, and the Make rule as a GitLab CI Job.
Say I have n microservices services in my project folder such as:
.gitlab-ci.yml
mircoservices/a/Dockerfile
mircoservices/b/Dockerfile
mircoservices/c/Dockerfile
mircoservices/n/Dockerfile
Rather than defining a n jobs to test and n jobs to build I use glob it such as
build:
glob: microservices/*/Dockerfile
image: dnd
stage: build
script:
- docker build $glob;
only_on_change: true
GitLab CI would parse this glob and create separate job for each match, in effect resulting in build jobs for 'a' and 'b' because they had changes reflected in the push:
build_a:
glob: microservices/*/Dockerfile
image: dnd
stage: build
script:
- docker build microservices/a;
build_b:
glob: microservices/*/Dockerfile
image: dnd
stage: build
script:
- docker build microservices/a;
Lots of other details to work out in a design, but I think looking to Bash like globs and GNU Make for inspiration would help us pin down easy to use and expected glob patterns.