I have set up a Cloud Build pipeline for deploying a Firebase web app.
The problem
The current script does unnecessary deployments. Even if backend files hadn't changed, it ends up testing and deploying the backend (takes 3 minutes; 4 minutes with backend tests).
Likewise for front-end (build and deploy only ~30s).
Context
GitHub / Cloud Build integration works so that Cloud Build is informed after the PR is already merged. That's fine.
I can make two separate CI jobs, filtered by the files that changed (this is available in Cloud Build console). The problem here is that if both change in the same commit, I would like the backend to be deployed first.
Come to think of it, I can bypass this by giving development guidance: if there are breaking changes (eg. a data model changes in the backend, or a new service such as Cloud Storage is added), those changes need to be deployed first in the backend. Making eg. two commits or deploying the backend manually.
What would you do??
I think the above side-thought is where I'm heading.
If you have experience with Cloud Build, how do you tackle this kind of cases?
Link changed to how the code was at the time of writing the question.
Added Jul'22: I ended up doing as pondered in the quote part: have separate triggers for "things changed in backend", "things changed in front-end". They may freely compete on which one gets deployed first; if it ever becomes an issue, the quoted manual process would work.