Guides
Advanced
Watch Paths

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

You can configure Watch Paths in two places. The first is in the flightcontrol.json file if you are using infrastructure as code. The second is in the dashboard.

In the dashboard, under a service's Miscellaneous section, you will find an Add Item button to add a watch path:

Add a watch path in the dashboard

After clicking the button, you will see an input field where you can enter the glob pattern:

Input field for a watch path

Conclusion

Watch Paths are a powerful tool for controlling deployments in monorepos. We recommend their use for all users with monorepos. This will save you time and costs by only building and deploying the services that need to be deployed.