Using Watch Paths to Control Deployments
When you have a monorepo with source code for multiple Flightcontrol services, you may not want to redeploy all services if the code for only one service changes.
Flightcontrol supports this with Watch Paths that you can configure on each service in your project.
Watch Paths work with preview environments and standard deployments, and we recommend their use for all users with monorepos.
What are Watch Paths?
Watch Paths are glob patterns (opens in a new tab) used to filter the services that can be built and deployed.
As an example, your front end service might have a watch path of apps/frontend/**
, and your back end service would have a watch path of apps/backend/**
.
The front end service will only build and deploy if a changed file is detected in apps/frontend/
, such as apps/frontend/src/index.js
. If only that file is changed, the backend service won't build and deploy, because it doesn't match the watch path.
You can have directories in multiple watch paths - for instance if you had an apps/shared/**
watch path, you might add it to both the frontend service and the backend service.
We use a git diff from the last successful deployment to determine which watch paths match the change.
Configuration
- In flightcontrol.json
- In our dashboard, under the Advanced toggle: