Skip to content
jthegunner_

← All projects

flux-diff-action

Secret-safe, self-updating Flux manifest diff for pull requests (GitHub Action + CLI around flate)

ActiveCI passing

★ 0 · Last push 23 Nov 2026

Open on GitHub

Releases

  1. v0.2.0

    Changelog
  2. v0.2.0-rc.1

    Changelog
  3. v0.1.0

    Changelog
  4. v0.1.0-rc.3

    Changelog
  5. v0.1.0-rc.2

    Changelog
  6. v0.1.0-rc.1

    Changelog

README

🔍 flux-diff

A readable, secret-safe Flux manifest diff, posted as one pull request comment.

🌿 base revision  →  🔄 flux-diff + flate  →  💬 PR comment


📖 What it is

flux-diff shows what a pull request changes in a Flux/Kustomize repository, as the rendered manifests rather than the YAML source. It is a small Go CLI plus a composite GitHub Action. The Action posts the diff as one comment per pull request and edits it on every push.

Rendering is done by the flate CLI, which flux-diff runs as a separate process. flux-diff adds what a review needs around it:

  • 💬 a self-updating comment (found by a hidden marker, edited in place)
  • ✂️ truncation to the comment size limit, with the full report as an artifact
  • 🍴 a step-summary fallback for fork pull requests
  • 🛡️ a secret guard that masks values before anything is written
  • ⚙️ a repository configuration file, .flux-diff.yaml
 pull request            flux-diff                      flate (separate process)
┌────────────┐   ┌──────────────────────────┐   ┌───────────────────────────┐
│ base + head│──▶│ config from base revision │──▶│ render both, Secrets      │
└────────────┘   │ mask, format, truncate    │◀──│ skipped (--skip-kinds)    │
                 └─────────────┬────────────┘   └───────────────────────────┘
                               ▼
                    one PR comment (or step summary)

🧭 How it differs

Tool Difference
🔧 flate The renderer and differ that flux-diff drives. Used on its own it prints a diff; it does not post or update PR comments, handle forks, or guard secrets for you.
🏢 konflate A standing review service. flux-diff is a lightweight Action with no service to run: it renders in your CI job and exits.

📦 Installation

The GitHub Action downloads and verifies flux-diff itself, so nothing needs installing for CI use.

For local use, download the archive for your platform from the releases page. Archives are named flux-diff_<version>_<os>_<arch>.tar.gz for linux/amd64, linux/arm64 and darwin/arm64, and the release carries a checksums.txt. Verify the archive before using it (see docs/release.md).

Or build from source with Go:

go build ./cmd/flux-diff

You also need the flate executable. flux-diff fetch-flate downloads a checksum-verified copy.

Note
<version> stands for a release tag such as 0.1.0, without the leading v.


🖥️ Local usage

flux-diff fetch-flate --dest ./bin                       # checksum-verified flate download
flux-diff --flate-binary ./bin/flate --base main --path . # diff, Markdown on stdout
flux-diff --format json --base main                       # text, markdown or json
flux-diff event                                           # pr, head, base, fork of a pull_request event
flux-diff comment --pr 7 --body-file body.md              # needs GITHUB_TOKEN, GITHUB_REPOSITORY

Main flags of the diff command:

Flag Meaning
🌿 --base revision to compare against
📁 --path directory of the Flux manifests (default .)
🧾 --format markdown (default), text or json
⚙️ --config, --config-base-rev, --config-name configuration file, or read it from a git revision
🔑 --registry-config registry credentials file passed to flate
✂️ --max-size, --output, --full-output truncation and output files
🚦 --strict also exit 1 when units are only partially rendered or broken in base and head
🔧 --flate-binary flate executable to run (default flate from PATH)
⏱️ --flate-timeout maximum run time of each flate process (default 10m)

Run flux-diff --help for the complete list.

The json format serializes the result model. Units that fail identically in base and head are listed under BrokenInBothSides, one object per unit with Kind, Namespace, Name and Blocks (the units it prevents from rendering). The failure reason is intentionally not part of it, see Limits.


🚀 GitHub Action

A complete workflow is in examples/workflow.yaml:

on: pull_request   # pull_request_target is not supported

permissions:
  contents: read
  pull-requests: write

jobs:
  diff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4          # pin to a full commit SHA in practice
        with:
          ref: ${{ github.event.pull_request.head.sha }}   # the PR head, not the merge commit
          fetch-depth: 0                                    # the merge base needs the history
          persist-credentials: false

      - uses: JtheGunner/flux-diff-action@<full commit SHA>
        with:
          version: v0.1.0          # flux-diff release tag; required, "latest" is rejected
          path: .                  # directory of the Flux manifests
Input Default Meaning
🏷️ version required flux-diff release to run; its checksum is verified before use
🧰 flate-version v0.7.3 flate release; only versions with a checksum built into flux-diff
📁 path . directory of the Flux manifests
⚙️ config .flux-diff.yaml configuration file name inside path
🔀 base merge base revision to compare against
🔑 registry-config none registry credentials file passed to flate
✂️ max-comment-size 65000 longer diffs are truncated and uploaded as the flux-diff-full artifact
⏱️ flate-timeout 10m maximum run time of each flate process; a hung flate is killed and reported as a failed run
🚦 fail-on-error false fail the step when units failed; otherwise only a warning

The step output outcome is created, updated or step-summary.

  • One comment per PR. It is found by a hidden marker and edited on every push.
  • Fork PRs have a read-only token. They get the diff in the job's step summary instead of a comment.
  • GITHUB_TOKEN is the workflow's default token. It reaches only the step that writes the comment, and only needs pull-requests: write.
  • pull_request_target is not supported: it would run with a write token next to untrusted code.

Tip
Pin the action to a full commit SHA, not to a tag or branch.

🔐 Trust model of the downloads

  • flate is checked against SHA-256 digests that are embedded in the flux-diff binary. They ship with the action's own code, so they are covered by whatever you pin.
  • flux-diff is downloaded from the release of this repository and checked against the checksums.txt of the same release. That detects corruption and mixed-up assets, but not a compromised release: whoever can replace the archive can replace the checksum file too.
  • The stronger controls are to pin the action to a full commit SHA, to use a release version you have reviewed, and to verify the build provenance attestation of the release (gh attestation verify, see docs/release.md).

See docs/e2e-acceptance.md for a manual acceptance run.


⚙️ Configuration: .flux-diff.yaml

All keys are optional and unknown keys are rejected. Each maps to a flate flag or to the secret guard.

supply: [clusters/prod/vars]      # flate --supply (paths relative to the repo root)
apiVersions: [monitoring.coreos.com/v1]
stripAttr: [checksum/config]      # added to flate's default stripped attributes
stripField: [metadata.annotations.example]
extraSkipKinds: [Namespace]       # skipped in addition to Secret
maskPatterns: ["*token*", "*apikey*"]  # extra key globs the guard masks
kubeVersion: "1.30.0"
allowMissingKinds: [Certificate]
  • supply paths must be relative; absolute paths, .. and symlinks that leave the repository are rejected, because the file is untrusted input.
  • There is no key for registry credentials. A credentials file can name helper programs that would run from PATH, so it is accepted only through --registry-config or the Action's registry-config input.
  • The Action reads the file from the base revision, never from the pull request head. A PR cannot weaken its own checks by editing the file.

🛡️ Masking guarantees

  • flate always runs with --skip-kinds Secret (and CustomResourceDefinition). A configuration that would render Secrets is rejected, so no Secret object reaches the diff.
  • Values are masked in the result model before formatting, logging, error construction or artifact writing. Masked values appear as <masked>, or as <masked, changed> when the value differs between the revisions.
  • maskPatterns adds extra key globs for the secret guard; values under matching keys are masked too. Matching is case-insensitive. The key name stays readable, only the value is masked. A key that equals a secret value is masked at any length, and a secret value of at least 8 characters is also removed when it is embedded in a key name (plain, base64 or JSON-escaped). Shorter values are not matched inside key names, so that a key such as password is not masked because a value like word exists. Limit: a secret value shorter than 8 characters that is embedded in a key name stays visible there. Keys inside Secret objects are always masked strictly.
  • flux-diff never decrypts SOPS. Encrypted inputs stay unresolved and the unit is reported as partial.

Honest limits:

  • Partial units. A unit that cannot be fully rendered is reported as partial or failed with a reason. It is never dropped or shown as "no changes". Use --strict or fail-on-error to turn them into failures.
  • Hung flate. Each flate process (version check, diff, build) is limited to flate-timeout (default 10 minutes). A process that runs longer is killed and the comment reports the run as failed with the reason, instead of the job hanging until its own time limit. Raise flate-timeout for repositories that render very large Helm charts; set the job's timeout-minutes above it.
  • SOPS is not diffable. Only ciphertext is available, so changes inside encrypted values cannot be shown.
  • Free-form messages (warnings, failure reasons, stderr lines) contain nothing beyond what flate prints, which names keys and objects but not values. They are only as safe as flate's text. A kind: List that wraps Secrets is not masked structurally; skipping Secret in flate is what keeps those out.

🧱 Limits

  • Only the pull_request event is supported.
  • Runners: Linux and macOS, amd64 or arm64.
  • Only the working tree at --path is compared against --base; other head revisions are not supported yet.
  • flate versions are limited to those with a checksum built into flux-diff.
  • A unit that is broken in the same way in the base and the head revision (for example a spec.path that never existed) cannot be diffed, and flate's diff does not mention it. flux-diff therefore also runs flate build on the head (one extra render run, Secrets skipped) and lists every unit that fails there but that the diff did not report as Already broken in base and head, with the units it blocks. The reason is intentionally not shown: such a unit has no objects in the diff, so a value quoted in its error text could not be masked. Run flate build locally to read it. This relies on one assumption: flate stays silent in the diff for a failure that is identical on both sides. The notice does not change the exit code; with --strict it does, like any other partial result. If flate build fails but prints no failure in a known format, the run fails with a fixed error rather than looking clean. A unit that a pull request breaks, adds or deletes is reported as failed with a reason.

🤝 Contributing

Report bugs and ideas as GitHub issues. For a change, open a pull request against main. Run the checks locally before you do:

gofmt -l .
go vet ./...
golangci-lint run
go test ./...

Golden files update with go test ./... -update; review the diff by hand before committing. Fixtures use fake secrets only, marked FAKE-DO-NOT-USE. Release steps are in docs/release.md.


📝 Changelog

See CHANGELOG.md.


📄 License

flux-diff is released under the MIT License.

flate is licensed under AGPL-3.0. flux-diff only runs it as a separate process. It does not link flate, and it does not bundle it: the Action downloads flate at run time and verifies it against a pinned checksum. Your use of flate is governed by its own license.


Built for readable GitOps reviews.