From ecfc6513e524c16625cf2ec3a67483b783e9a4d3 Mon Sep 17 00:00:00 2001 From: Kyle Harding Date: Fri, 4 Dec 2026 09:12:28 -0500 Subject: [PATCH] Run pre-commit hooks without Docker where possible Match balena-pihole and balena-adguard. actionlint switches to the golang hook, so pre-commit builds it without Docker. hadolint has no equivalent hook that needs no local install, so it stays on Docker but pins the image by tag and digest, since the upstream entry is untagged. Add check-json, check-merge-conflict, markdownlint and gitleaks, and fix the existing markdownlint findings. markdownlint skips LICENSE.md so the license text stays untouched. Signed-off-by: Kyle Harding --- .markdownlint.yaml | 3 +++ .pre-commit-config.yaml | 20 +++++++++++++++++++- CONTRIBUTING.md | 14 ++++++++------ README.md | 5 ++++- 4 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 .markdownlint.yaml diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..d0671bf --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,3 @@ +# Tables carry long URLs and cannot wrap. Prose keeps the 80 column limit. +MD013: + tables: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3c0f71b..2f7f5f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,6 +7,8 @@ repos: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml + - id: check-json + - id: check-merge-conflict - id: check-added-large-files - repo: https://github.com/renovatebot/pre-commit-hooks @@ -17,9 +19,25 @@ repos: - repo: https://github.com/rhysd/actionlint rev: v1.7.12 hooks: - - id: actionlint-docker + - id: actionlint - repo: https://github.com/hadolint/hadolint rev: v2.15.1 hooks: - id: hadolint-docker + # The upstream entry is untagged, so `rev` alone pins no image. + entry: ghcr.io/hadolint/hadolint:v2.15.1@sha256:32dac94127fd60b7b7e3fbfc65e1383b9b5e25c9bfd7b8536de7a539fe68a12d hadolint + +- repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.50.0 + hooks: + - id: markdownlint + exclude: ^LICENSE\.md$ + +- repo: https://github.com/gitleaks/gitleaks + rev: v8.30.1 + hooks: + # `gitleaks-docker` is not used because its image reference carries no tag. + - id: gitleaks + # The default entry scans staged changes only, so it scans nothing in CI. + entry: gitleaks dir --redact --verbose . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6cd6ba4..34fc0ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -119,11 +119,12 @@ People _love_ thorough bug reports. I'm not even kidding. ## Packaging new Unbound releases -> **Automated:** The [`Bump Unbound`](.github/workflows/bump-unbound.yml) workflow runs -> weekly (and on demand via **Run workflow**). It detects new upstream releases, updates -> the `ARG` fields below, regenerates the example config, sanity-builds the image, and -> opens a `Bump Unbound to X.Y.Z` PR for review. The manual steps below are the fallback -> for out-of-band bumps or when you want to drive it by hand. +> **Automated:** The [`Bump Unbound`](.github/workflows/bump-unbound.yml) +> workflow runs weekly (and on demand via **Run workflow**). It detects new +> upstream releases, updates the `ARG` fields below, regenerates the example +> config, sanity-builds the image, and opens a `Bump Unbound to X.Y.Z` PR for +> review. The manual steps below are the fallback for out-of-band bumps or when +> you want to drive it by hand. 1. In your working copy, create a new branch if you haven't already, and update the following fields in the [Dockerfile](Dockerfile) with the new version and @@ -150,7 +151,8 @@ People _love_ thorough bug reports. I'm not even kidding. For the current pattern, see recent commits touching the Unbound `ARG` lines: ```bash -git log --oneline -- Dockerfile | grep -iE "bump unbound|update unbound" | head -5 +git log --oneline -- Dockerfile | + grep -iE "bump unbound|update unbound" | head -5 ``` ## Tagging a release (maintainers only) diff --git a/README.md b/README.md index eeb709f..7848fce 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,10 @@ docker run --name unbound \ The cache DB module was compiled into daemon, but is disabled by default. To enable this module, follow this steps: -- You will need a Redis-protocol-compatible backend (e.g. Redis or Valkey) running and reachable from the Unbound container; see [examples/redis](https://github.com/klutchell/unbound-docker/tree/main/examples/redis) for a full docker-compose example; +- You will need a Redis-protocol-compatible backend (e.g. Redis or Valkey) + running and reachable from the Unbound container; see + [examples/redis](https://github.com/klutchell/unbound-docker/tree/main/examples/redis) + for a full docker-compose example; - Create a `cachedb.conf` under your custom configuration directory `/path/to/config/custom.conf.d`; - Add a `server` directive with module configuration to enable `cachedb` module; - Add a `cachedb` directive with Valkey (Redis-compatible) credentials;