Find version drift across repos
relgap drift scans directories for repositories and prints a matrix: a row per repository and a column per tool that drifts. A tool drifts when its pins stand for more than one version across the scanned repositories. drift reads files only and sends no request unless you add --latest. Drift explains how relgap compares the pins.
Scan a tree of repositories
Name the directories to scan. Each one may hold many repositories: a directory with .git is a repository, and a root without any .git counts as one repository itself.
relgap drift ~/src/infra ~/src/appsWithout arguments, drift scans the directories in scan.roots, then the current directory. Set scan.roots in your user config to scan the same trees from anywhere:
# ~/.config/relgap/config.yaml
scan:
roots: [~/src/infra, ~/src/apps]The output below comes from a test tree of 60 repositories in six team folders:
relgap drift tree --format plainREPO image:golang kubectl node terraform tfprovider:hashicorp/aws
tree/team-00/repo-00 1.26.1* 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-01 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-02 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-03 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-04 1.27.3 1.33.5* 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-05 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-06 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-07 1.27.3 1.34.2 24.11.0, ≈26 1.14.2* 6.12.0
tree/team-00/repo-08 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-00/repo-09 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-10 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-11 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.10.0*
tree/team-01/repo-12 1.26.1* 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-13 1.27.3 1.34.2 24.10.0*, ≈26 1.15.8 6.12.0
tree/team-01/repo-14 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-15 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-16 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-17 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-18 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-01/repo-19 1.27.3 1.33.5* 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-20 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-21 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-22 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-23 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-24 1.26.1* 1.34.2 24.11.0, ≈26 ≈1.15.0* 6.12.0
tree/team-02/repo-25 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-26 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-27 1.27.3 1.34.2 24.11.0, ≈26 1.14.2* 6.12.0
tree/team-02/repo-28 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-02/repo-29 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-30 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-31 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-32 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-33 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-34 1.27.3 1.33.5* 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-35 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-36 1.26.1* 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-37 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-38 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-03/repo-39 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-40 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-41 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.10.0*
tree/team-04/repo-42 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-43 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-44 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-45 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-46 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-47 1.27.3 1.34.2 24.11.0, ≈26 1.14.2* 6.12.0
tree/team-04/repo-48 1.26.1* 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-04/repo-49 1.27.3 1.33.5* 24.11.0, ≈26 ≈1.15.0* 6.12.0
tree/team-05/repo-50 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-51 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-52 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-53 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-54 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-55 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-56 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-57 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-58 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
tree/team-05/repo-59 1.27.3 1.34.2 24.11.0, ≈26 1.15.8 6.12.0
≈ allows more than one version. A constraint counts as an exact pin it allows in the same repo, else as its lower bound.
* differs from the version most repos pin.
In agreement: gh 2.83.0 (60 repos), helm 3.19.0 (60 repos), image:node 24.11.0 (60 repos), jq 1.7.1 (1 repo), terragrunt ≈1.2.0 (60 repos)
Not compared: go ≈1.27 (60 repos)
5 of 11 tools drift across 60 repos.A version marked * differs from the version most repositories pin. Tools that agree everywhere, or that only one repository pins, are listed below the matrix.
What counts as a version
Each cell shows the versions a repository pins for the tool. An exact pin counts as its version. A value marked ≈ allows more than one version:
- A constraint such as
~> 1.15counts as the highest exact pin of the tool in the same repository that satisfies it, otherwise as its lower bound (1.15.0). In the sample,repo-07pins terraform 1.14.2 next to~> 1.14, so it counts as 1.14.2. - A prefix such as
26and a channel such aslatestaren't compared. They show in the cell, and the tool goes under "Not compared" when no other pin of it is.
--drift-ignore-constraints compares exact pins only. Constraint pins still show, but they no longer count.
Pick the tools
--tool limits the report to the named tools and gives each one a column, even when every repository agrees on it:
relgap drift ~/src/infra --tool terraform --tool terragruntignore rules in the config drop pins before drift compares them. A rule names a tool and, optionally, a glob on the file path:
ignore:
- tool: terraform
path: "**/legacy/**"Pins and detectors lists the files each detector reads. --submodules also scans checked-out git submodules as repositories.
Add the latest versions
--latest adds a latest row with the newest stable version of each tool, and the agreement line names the latest version too. It needs the network or the cache:
relgap drift ~/src/infra --latest --format mdTo see how far each pin is behind latest, with release notes and EOL data, use relgap outdated in each repository.
Gate CI on drift
--fail-on drift counts the drifted pins, the cells marked *, and exits 3 once the count reaches --min-count (default 1). A file that doesn't parse, or a tool whose latest version can't be listed, exits 1 when the gate didn't match. The report is written either way.
relgap drift --fail-on drift --min-count 3 --format sarif > drift.sarif--format sarif writes a result per drifted pin at its file and line, and a failed result per file or tool that failed. Upload SARIF to code scanning shows the upload step, and SARIF rules lists the rules. --out writes several formats from one run, as in Gate CI on breaking changes, EOL and vulnerabilities.
To compare Terraform units that tfcensus found, see Feed tfcensus inventory into drift.