Skip to content

Pins and detectors ​

A pin is one tool version written in a file of your repository: terraform 1.15.8 in mise.toml, FROM golang:1.27.3 in a Dockerfile, ~> 6.0 for the AWS provider in main.tf. relgap pins lists them, and relgap outdated, relgap drift and relgap digest --all start from the same scan. The scan reads files only and makes no network call.

What a pin holds ​

Each pin has the name as written (TERRAFORM_VERSION, hashicorp/aws), the value as written, the file and line, the detector that found it, and the tool name relgap maps it to. A pin has one of six kinds:

KindTool nameExample
toolthe registry name, or the repository on its hostterraform, node, bitbucket:acme-ws/tf-network, gitlab:acme/platform/tf-dns
imageimage: and the image, with a tag pattern for a variantimage:golang from FROM golang:1.27.3, image:golang:*-alpine from FROM golang:1.27.3-alpine
actionaction: and the actionaction:actions/checkout, with scan.detectors.ci_actions
tfprovidertfprovider: and the providertfprovider:hashicorp/aws
tfmoduletfmodule: and the registry moduletfmodule:terraform-aws-modules/vpc/aws from a module block
chartchart: and the chartchart:argo-cd from Chart.yaml

A chart pin also keeps the Helm repository URL it names (registry_url in JSON), from a Chart.yaml dependency's repository or a Renovate comment's registryUrl. relgap outdated and relgap digest --base use it to find the chart's Artifact Hub repository. When Artifact Hub has no repository at that URL with the chart, the pin is named chart:<url>/<name>. A GitHub Pages URL (https://<owner>.github.io/<repo>) then reads the chart's versions from the index.yaml that chart-releaser publishes on the gh-pages branch, through the GitHub API. An oci:// URL reads them from the registry's tags, when the registry is one relgap reads images from (network), and takes the repository for notes from the chart's org.opencontainers.image.source annotation. Any other URL is skipped with that reason; relgap never swaps in another repository's chart of the same name.

Tables show such a chart in a short form, which relgap resolve and relgap digest accept too: chart:aws/secrets-store-csi-driver-provider-aws/secrets-store-csi-driver-provider-aws for https://aws.github.io/secrets-store-csi-driver-provider-aws, and chart:quay.io/jetstack/charts/cert-manager for oci://quay.io/jetstack/charts. Tables sort by that short form, and so does the JSON of outdated and drift. JSON keeps the URL.

A # renovate: comment with extractVersion=^<prefix>(?<version>...)$ on a github-releases or github-tags datasource names the tool github:<owner>/<repo>@<prefix>, whose tags carry that prefix: extractVersion=^cluster-autoscaler-(?<version>.+)$ on kubernetes/autoscaler reads only the cluster-autoscaler-1.37.0 tags. A trailing v? is allowed. Any other form leaves the pin unresolved, because comparing it with every tag of the repository would be wrong. relgap ignores versioning and orders versions with the tool's scheme. A module whose source is a git repository on github.com with ?ref= is a tool pin of github:owner/repo, and its ref counts as a version only when it is 1.2.3 or v1.2.3. The same holds on bitbucket.org (bitbucket:workspace/repo), on gitlab.com (gitlab:group/.../repo) and on a host in gitlab.hosts (gitlab:<host>/group/.../repo). A git source on any other host stays unresolved.

The value decides which versions the pin allows. An exact pin such as 1.15.8 allows one version. relgap marks the other three forms with ≈:

  • a constraint (~> 1.15, >= 1.5, < 2, 1.x) allows a range;
  • a prefix (26, 3.14, prefix:1.2) allows every version that starts with it, as mise reads it;
  • a channel (latest, lts, ref:main) names no version at all.

Terraform reads a bare 6.0 as exactly 6.0.0, so in .tf files a partial version is an exact pin. An image tag names one image, so python:3.14-slim is an exact pin of the tag 3.14-slim too. Versions, ranges and release lines says how each form becomes one version when a command needs one.

Finding repositories and files ​

Each root you pass (default: scan.roots, then the current directory) is searched for directories that contain .git. Each one is a repository, and the scan doesn't descend into another repository below it. A root without any .git is one repository itself. --submodules scans checked-out git submodules as repositories of their own.

relgap lists a repository's files with git ls-files, so .gitignore applies. Without git, it walks the directory and skips .git, .terraform, .terragrunt-cache, node_modules and vendor. Files that match a scan.exclude glob are never read; the default excludes **/node_modules/** and **/.terragrunt-cache/**. Files over 2 MB and binary files are skipped.

Detectors ​

A detector reads one family of files. Every file that matches a detector's names is read by it:

DetectorFilesPins
aquaaqua.yaml and aqua.yml, with or without a leading dot, and YAML files in an aqua directorypackages[] entries written as name: pkg@version or name plus version
ciGitHub Actions workflows, .gitlab-ci.yml and bitbucket-pipelines.ymlimage keys and job containers as image pins, keys such as TERRAFORM_VERSION or go-version as tool pins, and uses: as action pins with scan.detectors.ci_actions (a commit SHA takes the version in its line comment); values with variables are skipped
dockerfileDockerfile*, Containerfile* and *.dockerfileFROM image tags with ARG defaults filled in, and ARG or ENV NAME_VERSION values; a # renovate: comment above an ARG or ENV names the tool
genericthe files scan.extra_files names, with scan.detectors.generic onNAME_VERSION = x.y.z assignments in any text file
helmChart.yamldependencies[] as chart pins with their repository URL, and appVersion as a pin of the tool named like the chart
idiomatic.terraform-version, .terragrunt-version, .node-version, .nvmrc, .python-version, .go-version and go.modthe first version line of a version file; go.mod's go line as a constraint and its toolchain line
misemise.toml, .mise.toml, mise.*.toml and the conf.d files of a mise directoryeach version under [tools]: a string, each string of an array, or the version key of a table
renovatethe file pins --renovate-report names, not repository fileseach dependency of Renovate's extract report, resolved like the other pins
renovate-comment*.tf, *.tfvars, *.hcl, *.yml, *.yaml, Makefile, GNUmakefile, *.mk, pom.xml, .sh, .env, .env. and the files scan.extra_files namesthe one version on the line after a # renovate:, // renovate: or <!-- renovate: --> comment, named by its datasource and depName
terraform*.tf and *.tf.jsonterraform { required_version } and required_providers constraints, a provider without a source being hashicorp/<name>; module versions as tfmodule pins and GitHub ?ref= module sources
terragruntevery .hcl file except .terraform.lock.hclterraform_version_constraint and terragrunt_version_constraint as literal strings at the top level, and terraform { source } with tfr:// ?version= or a GitHub ?ref=
tf-lock.terraform.lock.hclthe exact version of each provider
tfcensusthe tfcensus inventory drift --from-tfcensus reads, not repository filesexact terraform or opentofu and provider versions per unit and workspace
tool-versions.tool-versionsa tool name followed by one or more versions

Two detectors are off by default. scan.detectors.ci_actions adds the uses: pins of GitHub Actions; CI files are read for tool versions either way. A pin by commit SHA is exact at the version its line comment names (@<sha> # v4.1.3, also # tag=v4.1.3), the comment Renovate writes when it pins an action. A bare SHA, or a comment with only a major version (# v4), is not exact. scan.detectors.generic reads the files scan.extra_files names, such as Makefile or **/*.env, for NAME_VERSION = x.y.z lines.

From a name to a tool ​

A raw name becomes a tool name through the same layers as relgap resolve, without any network lookup. A NAME_VERSION variable maps to the tool name, with underscores read as hyphens: TERRAFORM_VERSION is terraform. In a Dockerfile, a # renovate: comment above an ARG or ENV names the tool for the line below, as Renovate's custom managers read it.

Renovate comments ​

The renovate-comment detector reads the comments that Renovate's regex custom managers use, in .tf, .tfvars, .hcl, YAML, Makefiles, pom.xml, shell scripts, .env files and the files scan.extra_files names:

hcl
variable "karpenter" {
  type = object({
    # renovate: datasource=helm depName=karpenter registryUrl=oci://public.ecr.aws/karpenter
    chart_version = optional(string, "1.8.1")
  })
}

The first line after the comment that is neither blank nor a comment must hold exactly one version, which becomes the pin. // and <!-- --> comments work too. The datasource sets the kind: helm gives a chart pin, github-releases and github-tags a github: pin, terraform-provider and terraform-module a provider or module pin, docker an image pin, bitbucket-tags a bitbucket: pin, gitlab-tags and gitlab-releases a gitlab: pin (with the host of registryUrl when it is in gitlab.hosts), git-tags and git-refs the pin of the repository their URL names, and aqua, npm and pypi their package. On a docker datasource, extractVersion=^<prefix>(?<version>...)<suffix>$ names the tool image:<name>:<prefix>*<suffix>. Any other datasource looks the tool up by packageName, then depName. When another detector found a pin on the same line with the same value, the comment's pin replaces it. Dockerfiles keep their own detector, which reads these comments above ARG and ENV.

Unresolved pins ​

A pin whose name maps to no tool keeps an empty tool. relgap pins --unresolved lists them, and aliases in the config maps a raw name to a tool. Map unresolved pins walks through it.

Leaving pins out ​

ignore rules in the config drop the pins of a tool, everywhere or only under a path glob:

yaml
ignore:
  - tool: java
  - tool: terraform
    path: "**/legacy/**"

The glob matches the repository and file (infra/legacy/main.tf) or the file alone, and ** stands for any number of directories. The tool may be an alias. Ignore rules apply to relgap outdated, relgap drift and every digest that starts from a scan (--from-mise, --all, --base and --pull-request). relgap pins lists every pin, ignored or not.

relgap pins --renovate-report adds the dependencies of a Renovate extract report to the scan; Use Renovate's extract report has the details.