I was trying to implement a CI for a monolithic client and i wanted to optimize the time needed for the CI. One of the most consuming jobs is/are the tests. With monolith we get problems like “what changed/what to do”.
So to start i did this:
test-backend:
stage: test
only:
changes:
- backend/**/*
The problem is that if the push does not have any backend modifications it won’t run the pipeline, logic right? well, no, if i did 3 commits for the backend (and push) and 1 for the frontend (and push) the last push wont have any backend tests and if i try to create a MR from it, it will say its good to be merge ( because it didn’t run the backend tests).
Then i saw only:refs:merge_requests
but i dont know how to get this together… i want to do if there is a change on X directory on the push/commit OR there is a change on X directory on the MR. is there anyway to do this in any Gitlab version? ( current 11.4 - EE but can be upgraded)