1
0
mirror of synced 2026-02-06 10:55:56 +00:00

Add digest pinning to image automation testing

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
Stefan Prodan
2025-06-01 21:23:48 +03:00
parent 2f5f40d593
commit be8acc0cfb
5 changed files with 46 additions and 26 deletions

View File

@@ -5,7 +5,7 @@ metadata:
namespace: flux-system
spec:
image: ghcr.io/stefanprodan/podinfo
interval: 1m0s
interval: 10m
---
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
@@ -13,11 +13,13 @@ metadata:
name: podinfo
namespace: flux-system
spec:
interval: 10m
imageRepositoryRef:
name: podinfo
policy:
semver:
range: 5.2.x
range: 6.x
digestReflectionPolicy: Always
---
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageUpdateAutomation
@@ -37,7 +39,22 @@ spec:
author:
email: fluxcdbot@users.noreply.github.com
name: fluxcdbot
messageTemplate: '{{range .Updated.Images}}{{println .}}{{end}}'
messageTemplate: |
Automated image update
Automation name: {{ .AutomationObject }}
Files:
{{ range $filename, $_ := .Changed.FileChanges -}}
- {{ $filename }}
{{ end -}}
Changes:
{{ range $resource, $changes := .Changed.Objects -}}
{{- range $_, $change := $changes }}
- {{ $change.OldValue }} -> {{ $change.NewValue }}
{{ end -}}
{{ end -}}
push:
branch: main
update:

View File

@@ -2,9 +2,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: flux-system
resources:
- https://raw.githubusercontent.com/stefanprodan/podinfo/5.2.0/kustomize/deployment.yaml
- https://raw.githubusercontent.com/stefanprodan/podinfo/6.8.0/kustomize/deployment.yaml
- auto.yaml
images:
- name: ghcr.io/stefanprodan/podinfo
newName: ghcr.io/stefanprodan/podinfo
newTag: 5.2.0 # {"$imagepolicy": "flux-system:podinfo:tag"}
newName: ghcr.io/stefanprodan/podinfo # {"$imagepolicy": "flux-system:podinfo:name"}
newTag: 6.8.0 # {"$imagepolicy": "flux-system:podinfo:tag"}
digest: "sha256:6c1975b871efb327528c84d46d38e6dd7906eecee6402bc270eeb7f1b1a506df" # {"$imagepolicy": "flux-system:podinfo:digest"}