See what a Flux pull request really changes, before you merge it. Right in CI and fully standalone: no cluster, no kubeconfig, no agent to install.
GitHub Actions that comment on every pull request, Renovate ones included:
- π¦ Flux diff: the rendered manifests of every HelmRelease the pull request touches, old chart and values against new ones, plus what the git diff hides in Kustomizations (remote resources, other Flux sources, shared bases, CRDs). Changes that will fail the reconciliation, such as an immutable field updated, risky deletions, such as a PersistentVolumeClaim, and new privileges are flagged at the top; a pull request that only bumps images and versions is labelled routine.
- π‘οΈ CVE diff: for every container image the pull request changes, the vulnerabilities of the old and new image side by side, then the High/Critical CVEs (configurable) of the new image, the ones it adds flagged π, the ones it fixes. Scanned by grype.
- π No secret needed: SOPS-encrypted values and Secrets are rendered with placeholders, so CI never holds the private key.
Each comment is updated on every push. When there is nothing to report, a short comment
says so, so you know the check ran; set comment-when-unchanged: false to stay silent
instead (an existing comment is still refreshed).
Important
Flux repositories only for the Flux diff and the image discovery. Argo CD, Helmfile, plain Helm or Kustomize repositories are not supported. The CVE diff of an image built by the pull request works in any repository.
Example: a pull request that upgrades the traefik chart (42.3.2 β 42.4.0) and its image (v3.7.17 β v3.7.18, pinned by digest), enables its PodDisruptionBudget, and adds a shared component (labels and resource limits) to the whoami Kustomization. That last change is two lines in the pull request diff:
resources:
- deployment.yaml
+components:
+ - ../../components/commonand below, what it really changes once rendered.
CVE diff
Image Version Critical High Medium Low Fixable docker.io/traefikv3.7.17@f4bb143βv3.7.18@9c437ac0 2 β 1 β 4 1 2 β 1 β
docker.io/traefik: 1 High/Critical, 1 fixable, 1 added, 2 fixed
CVE Severity Packages Version Fixed in π CVE-0000-0004 High golang.org/x/netv0.47.00.48.0 Fixed
CVE Severity Packages Version Fixed in CVE-0000-0001 High stdlibgo1.25.41.25.5 CVE-0000-0002 High zlib1.3.1-r21.3.2-r0
Flux diff
HelmRelease Chart Added Changed Removed flux-system/traefiktraefik42.3.2 β 42.4.01 1
flux-system/traefik: 1 added, 1 changed--- Deployment traefik/traefik +++ Deployment traefik/traefik @@ -9,3 +9,3 @@ spec: - replicas: 1 + replicas: 2 revisionHistoryLimit: 10 @@ -44,3 +44,5 @@ - --providers.kubernetesgateway.gatewayClass=traefik + - --entryPoints.web.transport.lifeCycle.requestAcceptGraceTimeout=5s - --entryPoints.websecure.http.tls=true + - --entryPoints.websecure.transport.lifeCycle.requestAcceptGraceTimeout=5s - --log.level=INFO @@ -63,4 +65,4 @@ - name: USER value: traefik - image: docker.io/traefik:v3.7.17@sha256:f4bb143d1135a579b630ed491e17ec50f6f7c9c6a30585ff3d385471d2a86f5a + image: docker.io/traefik:v3.7.18@sha256:9c437ac4f09ce6f4980a8544902d3475fdf70a1a7c578729581d2535dfa7d635 imagePullPolicy: IfNotPresent --- PodDisruptionBudget traefik/traefik +++ PodDisruptionBudget traefik/traefik @@ -0,0 +1,11 @@ +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: traefik + namespace: traefik +spec: + maxUnavailable: 1 + selector: + matchLabels: + app.kubernetes.io/name: traefik + app.kubernetes.io/instance: traefik-traefik
Kustomization Why Path Added Changed Removed flux-system/whoamikustomization edited apps/whoami1
flux-system/whoami: 1 changed--- Deployment whoami/whoami +++ Deployment whoami/whoami @@ -4,6 +4,7 @@ labels: kustomize.toolkit.fluxcd.io/name: whoami kustomize.toolkit.fluxcd.io/namespace: flux-system + team: platform name: whoami namespace: whoami spec: @@ -18,3 +19,6 @@ containers: - image: docker.io/traefik/whoami:v1.10.4 name: whoami + resources: + limits: + memory: 128Mi1 more Kustomization changed exactly as the pull request diff shows.
Copy examples/flux-pr.yaml to .github/workflows/, then:
- set
pathto your cluster directory, the--pathgiven toflux bootstrap(the one holdingflux-system/, such asclusters/my-cluster); - adapt its
on.pull_request.pathsto your repository layout; - replace
<sha>with the commit of a release (a tag such as@v1.4.0works too; Renovate can pin it to its SHA).
Drop a job to turn its feature off:
jobs:
flux-diff:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: mydoomfr/gitops-actions/flux-setup@<sha> # v1.4.0
- uses: mydoomfr/gitops-actions/flux-diff@<sha> # v1.4.0
with:
path: clusters/my-cluster
image-scan: # read-only: the scanner pulls third-party images, see Security
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: mydoomfr/gitops-actions/flux-setup@<sha> # v1.4.0
- uses: mydoomfr/gitops-actions/flux-images@<sha> # v1.4.0
id: images
with:
path: clusters/my-cluster
- uses: mydoomfr/gitops-actions/cve-scan@<sha> # v1.4.0
with:
targets: ${{ steps.images.outputs.targets }}
notes: ${{ steps.images.outputs.notes }}
image-report:
needs: image-scan
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: mydoomfr/gitops-actions/cve-report@<sha> # v1.4.0Scan the image a pull request builds against the published one. One cve-scan job
per image, one cve-report job merging them into a single comment:
# The build job saves its image with `docker save -o image.tar` and uploads it with
# actions/upload-artifact as `my-app-image`; labels and the published image are yours.
cves:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/download-artifact@<sha> # the image saved by the build job
with:
name: my-app-image
path: ${{ runner.temp }}
- uses: mydoomfr/gitops-actions/cve-scan@<sha> # v1.4.0
with:
name: my-app
new-source: docker-archive:${{ runner.temp }}/image.tar
new-label: 1.2.0
old-source: registry:ghcr.io/me/my-app:1.1.0
old-label: 1.1.0
artifact-name: my-app-cves
cve-comment:
needs: cves
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: mydoomfr/gitops-actions/cve-report@<sha> # v1.4.0
with:
artifact-pattern: "*-cves"
name-header: AppSources are grype sources, such
as registry: or docker-archive:.
Encrypted values. Nothing to set up: flux-setup gives placeholders to the
SOPS-encrypted YAML files it finds. A Secret that only exists in the cluster needs
allow-missing-kinds: Secret. See SOPS without the private key.
Charts gated on a CRD API. A ServiceMonitor or an HTTPRoute renders only when its
API is listed in the api-versions input of flux-setup. See
Charts using CRDs.
To choose which Kustomizations the comment lists, and more, see Flux diff in detail and the inputs of every action.
| Action | What it does |
|---|---|
flux-setup |
Checks out the pull request in ./pr and its base in ./base, and prepares SOPS files. Run it first. |
flux-diff |
Comments the rendered HelmRelease and Kustomization diff. Needs pull-requests: write. |
flux-images |
Lists the images the pull request changes, each paired with the image it replaces. |
cve-scan |
Scans each new image and the one it replaces, uploads the scans as an artifact. Run it read-only. |
cve-report |
Downloads the scans and comments the CVE report. Needs pull-requests: write. |
pr-comment |
Creates or updates a comment tagged with a marker. Needs pull-requests: write. |
helm-diff |
Former name of flux-diff, kept until v2. |
- The scanner never holds a writable token:
cve-scanruns in a read-only job,cve-reportposts from another. - No secret in CI: SOPS values and Secrets are swapped for placeholders, never decrypted.
- Pinned dependencies: every third-party action is pinned by commit SHA; pin this repository the same way.
- Runs on
pull_requestevents only. Pull requests from forks get a read-only token, so no comment is posted on them. - The render is offline: Helm
lookupreturns nothing. - Private registries need credentials grype can read, such as a
docker loginin the scan job. - More in Flux diff and SOPS.
Under the hood, the Flux render is done by flate, an offline Flux renderer. To contribute, see CONTRIBUTING.md.