Skip to content
BETAGuardrails are in beta. The library, the configuration format and the CLI command can still change.

Guardrails / clojure

Clojure dependencies are pinned

clojure/dependencies-pinned@v1

Every dependency the manifests declare names one released version, or the exact commit a git dependency builds from.

Idclojure/dependencies-pinned
Versionv1
Categoryclojure
Default severitywarning
Interpreterpython3
Timeout30 seconds
Violations tolerated0
Collectsclojure

Collectors

This guardrail gathers nothing itself. It depends on the collectors below, which the CLI runs once per build before any check, and reads what they found out of GUARDRAIL_FACTS. A collector that collects nothing skips this guardrail rather than failing it.

CollectorGathersInputs it is given
clojureThe Clojure build in the project directory: which tool it uses, the Clojure version it depends on, the source paths and aliases it declares, the repositories it resolves from, and every dependency with its alias, origin and whether it is pinned.projectDir

The inputs above are this guardrail's own, passed straight through. Configuring one in buildnote.json changes what is collected, and two guardrails configured the same way share the one collection.

Configuration

json
{
  "guardrails": {
      "failOn": "error",
      "comment": true,
      "checks": [
          {
              "use": "clojure/dependencies-pinned@v1",
              "severity": "warning",
              "with": {
                  "projectDir": "."
              },
              "exemptions": []
          }
      ]
  }
}

Inputs

InputDescriptionDefaultEnvironment variable
projectDirDirectory holding the project, relative to the directory the CLI runs in..GUARDRAIL_INPUT_PROJECTDIR

How to fix

Name the release, and give every git coordinate the sha it resolves to:

clojure
{:deps {cheshire/cheshire {:mvn/version "5.13.0"}
        io.github.acme/queue {:git/url "https://github.com/acme/queue"
                              :git/tag "v1.4.0"
                              :git/sha "6f3a1c2d9b8e4f7a0c5d2e1b3a4f5c6d7e8f9a0b"}}}

A RELEASE, a LATEST or a -SNAPSHOT resolves to whatever the repository serves the moment the build runs, and a :git/url with no :git/sha to wherever the branch has moved, so the artifact that shipped is not the one that was reviewed.

More in clojure

  • clojure/no-local-dependencies. No dependency is taken from a :local/root, so the build resolves everything from this commit rather than from the machine it runs on.
  • clojure/repositories-allowed. Every Maven repository the manifest adds beyond the defaults resolves from a host on the allowed list.
  • clojure/version-declared. The project depends on the Clojure release it is built against, and that release is no older than the configured floor.

All 4 clojure guardrails

Buildnote Limited
Registered in England and Wales, Reg: 16140412