when: on_change (from fork point)
Description
I suggested this in gitlab-ce#23455 but it is really a separate feature. Often the line of mono-repo or many-repo is drawn at separate lifecycles. A project comprised of independent (but exclusive) microservices could benefit from a mono-repo but independent microservices need independent lifecycles (but not neccessarily different pipelines.
Proposal
We have "on_success, on_failure, always or manual options for when. I propose an option of "on_change" that will only execute if files in its context have changes. I started a Bash wrapper, lolaus, to do this but then the job still has to start to evaluate the wrapper and it would just be cleaner/better to have it built in.
build:
image: dnd
stage: build
context: microservices-1/
script:
- docker build .
when: on_change
on_change can be something like, git merge-base --fork-point master $(git symbolic-ref --short HEAD)