Data & Analytics
Before running dbt clean in CI, audit paths outside the project
Check clean-targets and version-specific safety behavior before a CI cleanup step removes or skips files outside the dbt project.
October 28, 2026
dbt clean is often treated as a harmless first step in CI. A current dbt v2 issue says an outside-project clean-targets entry is currently skipped with a warning, while dbt Core 1.x fails before deleting anything unless an explicit opt-out is used. The proposed v2 change is to fail before deletion and support an explicit override. That distinction matters in jobs where a skipped cleanup leaves stale artifacts or an unexpected path could be destructive.
Inventory what the command can touch
Review clean-targets, command-line path arguments, project root, working directory, and any CI variable that constructs paths. Resolve symlinks and relative paths in a disposable checkout. Classify each target: generated project artifact, shared cache, or outside-project directory. Do not assume a target is safe because its text begins with target/; its resolved location decides the risk.
Test the installed engine, not an assumed rule
Run a nonproduction fixture with a marker file inside and outside the project and observe the exit code, warning, and surviving files on the exact dbt version used in CI. Capture dbt1160 if it appears. The official command reference identifies clean as an artifact deletion command, but the issue records version-specific behavior that the team should verify locally. Avoid relying on a proposed flag until it is released and documented for your engine.
Make failure visible in the pipeline
If an outside path is not intentional, remove it from the cleanup configuration and fail CI on the warning or an equivalent preflight. If it is intentional, isolate that deletion in a clearly owned step with an explicit path and repository boundary. Confirm that downstream tests do not consume leftover artifacts after a skipped clean. A clean job is only reliable when both deletion and nondeletion are deliberate.
Adovo’s view
Cleanup is a production control when it runs before a release. A command that quietly skips a path can be as misleading as one that deletes too much. Make the target list explicit and test the installed version before trusting the pipeline's green light.
