Skip to content

Commit 1d6137d

Browse files
authored
Merge pull request #5383 from fluxcd/test-image-automation-digest
Add digest pinning to image automation testing
2 parents 2f5f40d + be8acc0 commit 1d6137d

File tree

5 files changed

+46
-26
lines changed

5 files changed

+46
-26
lines changed

.github/workflows/e2e-bootstrap.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ jobs:
107107
./bin/flux reconcile image repository podinfo
108108
./bin/flux reconcile image update flux-system
109109
./bin/flux get images all
110+
./bin/flux -n flux-system events --for ImageUpdateAutomation/flux-system
111+
kubectl -n flux-system get -o yaml ImageUpdateAutomation flux-system
110112
kubectl -n flux-system get -o yaml ImageUpdateAutomation flux-system | \
111113
yq '.status.lastPushCommit | length > 1' | grep 'true'
112114
env:

tests/image-automation/auto.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ metadata:
55
namespace: flux-system
66
spec:
77
image: ghcr.io/stefanprodan/podinfo
8-
interval: 1m0s
8+
interval: 10m
99
---
1010
apiVersion: image.toolkit.fluxcd.io/v1beta2
1111
kind: ImagePolicy
1212
metadata:
1313
name: podinfo
1414
namespace: flux-system
1515
spec:
16+
interval: 10m
1617
imageRepositoryRef:
1718
name: podinfo
1819
policy:
1920
semver:
20-
range: 5.2.x
21+
range: 6.x
22+
digestReflectionPolicy: Always
2123
---
2224
apiVersion: image.toolkit.fluxcd.io/v1beta2
2325
kind: ImageUpdateAutomation
@@ -37,7 +39,22 @@ spec:
3739
author:
3840
3941
name: fluxcdbot
40-
messageTemplate: '{{range .Updated.Images}}{{println .}}{{end}}'
42+
messageTemplate: |
43+
Automated image update
44+
45+
Automation name: {{ .AutomationObject }}
46+
47+
Files:
48+
{{ range $filename, $_ := .Changed.FileChanges -}}
49+
- {{ $filename }}
50+
{{ end -}}
51+
52+
Changes:
53+
{{ range $resource, $changes := .Changed.Objects -}}
54+
{{- range $_, $change := $changes }}
55+
- {{ $change.OldValue }} -> {{ $change.NewValue }}
56+
{{ end -}}
57+
{{ end -}}
4158
push:
4259
branch: main
4360
update:

tests/image-automation/kustomization.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33
namespace: flux-system
44
resources:
5-
- https://raw.githubusercontent.com/stefanprodan/podinfo/5.2.0/kustomize/deployment.yaml
5+
- https://raw.githubusercontent.com/stefanprodan/podinfo/6.8.0/kustomize/deployment.yaml
66
- auto.yaml
77
images:
88
- name: ghcr.io/stefanprodan/podinfo
9-
newName: ghcr.io/stefanprodan/podinfo
10-
newTag: 5.2.0 # {"$imagepolicy": "flux-system:podinfo:tag"}
9+
newName: ghcr.io/stefanprodan/podinfo # {"$imagepolicy": "flux-system:podinfo:name"}
10+
newTag: 6.8.0 # {"$imagepolicy": "flux-system:podinfo:tag"}
11+
digest: "sha256:6c1975b871efb327528c84d46d38e6dd7906eecee6402bc270eeb7f1b1a506df" # {"$imagepolicy": "flux-system:podinfo:digest"}

tests/integration/go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ require (
66
cloud.google.com/go/pubsub v1.49.0
77
github.com/Azure/azure-event-hubs-go/v3 v3.6.2
88
github.com/chainguard-dev/git-urls v1.0.2
9-
github.com/fluxcd/helm-controller/api v1.2.0
10-
github.com/fluxcd/image-automation-controller/api v0.40.0
11-
github.com/fluxcd/image-reflector-controller/api v0.34.0
12-
github.com/fluxcd/kustomize-controller/api v1.5.1
13-
github.com/fluxcd/notification-controller/api v1.5.0
9+
github.com/fluxcd/helm-controller/api v1.3.0
10+
github.com/fluxcd/image-automation-controller/api v0.41.0
11+
github.com/fluxcd/image-reflector-controller/api v0.35.1
12+
github.com/fluxcd/kustomize-controller/api v1.6.0
13+
github.com/fluxcd/notification-controller/api v1.6.0
1414
github.com/fluxcd/pkg/apis/event v0.17.0
1515
github.com/fluxcd/pkg/apis/meta v1.12.0
1616
github.com/fluxcd/pkg/git v0.31.0
1717
github.com/fluxcd/pkg/git/gogit v0.33.0
1818
github.com/fluxcd/pkg/runtime v0.60.0
19-
github.com/fluxcd/source-controller/api v1.5.0
19+
github.com/fluxcd/source-controller/api v1.6.0
2020
github.com/fluxcd/test-infra/tftestenv v0.0.0-20250519112614-4450eea17b00
2121
github.com/go-git/go-git/v5 v5.16.0
2222
github.com/google/go-containerregistry v0.20.3

tests/integration/go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2
113113
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
114114
github.com/fluxcd/gitkit v0.6.0 h1:iNg5LTx6ePo+Pl0ZwqHTAkhbUHxGVSY3YCxCdw7VIFg=
115115
github.com/fluxcd/gitkit v0.6.0/go.mod h1:svOHuKi0fO9HoawdK4HfHAJJseZDHHjk7I3ihnCIqNo=
116-
github.com/fluxcd/helm-controller/api v1.2.0 h1:cjpHBpJQv+8WyYQNwoujoNMFOQx2llllv4peLIiWyxU=
117-
github.com/fluxcd/helm-controller/api v1.2.0/go.mod h1:3NZts/4n6PpD4sONSDJWXPQzfPpBk3YpknIFA6rLW3I=
118-
github.com/fluxcd/image-automation-controller/api v0.40.0 h1:AgObtp2/bnOraIkkzkAl5kJDmDsBMOx/wDPQd6Yv7Is=
119-
github.com/fluxcd/image-automation-controller/api v0.40.0/go.mod h1:jqFjp75nUHQBeZp2cj2GZYE08l6/4Fz20PBXo41XYyM=
120-
github.com/fluxcd/image-reflector-controller/api v0.34.0 h1:+0AGoaYzHYXzVDQO9xq2eGZKkPl81Bfz6xFI7rElBzs=
121-
github.com/fluxcd/image-reflector-controller/api v0.34.0/go.mod h1:C6742RYyZVt2KIyJv16lb4gYbsK+P1RGQeaQ8C8huec=
122-
github.com/fluxcd/kustomize-controller/api v1.5.1 h1:SLVMIk/3E/GkK610S85zDBfX/TQhpE2ym+516ONXtU4=
123-
github.com/fluxcd/kustomize-controller/api v1.5.1/go.mod h1:SnQ5blin2e25GOCvd9JqYezYhqcM7beyK1aLq9Iw0So=
124-
github.com/fluxcd/notification-controller/api v1.5.0 h1:UFrOuaOrnQYhOg/i/Ylvs7TKJV5ggwVIt0zsiZy+rVA=
125-
github.com/fluxcd/notification-controller/api v1.5.0/go.mod h1:6RrjQrvIAAmi9fUfhqnQKTgxLvKzI0z6Lvzj6c5RyX4=
116+
github.com/fluxcd/helm-controller/api v1.3.0 h1:PupXPuQbksmU0g2Lc6NjIYal2HJGL+6xohsf82eGVjo=
117+
github.com/fluxcd/helm-controller/api v1.3.0/go.mod h1:4b8PfdH0e/9Pfol2ogdMYbQ1nLjcVu9gAv27cQzIPK4=
118+
github.com/fluxcd/image-automation-controller/api v0.41.0 h1:wItzHTo0w50NKaJ4wV6iXKbWo5vvjDpl6bY9NOK6Rs8=
119+
github.com/fluxcd/image-automation-controller/api v0.41.0/go.mod h1:u1L/gztaeJgwRQrPEx2DqE4mlYoAfSeKTWx/JLUxRbA=
120+
github.com/fluxcd/image-reflector-controller/api v0.35.1 h1:QpnLjPR4BMRQN2C+cL6NhjvsUCQoQS00Qq40DC85OtY=
121+
github.com/fluxcd/image-reflector-controller/api v0.35.1/go.mod h1:mjpokoQhFs2RxfFjY4rHpn3ZAUvee8TiELyROFN4wiA=
122+
github.com/fluxcd/kustomize-controller/api v1.6.0 h1:8p230vpJy7giisoBNuI3CX99O+XKKVLLxXuJmv3sOHQ=
123+
github.com/fluxcd/kustomize-controller/api v1.6.0/go.mod h1:b0i/KVz28tV8iuqlNHx7MW6ZtTcIbBELGLoKdaK+X8M=
124+
github.com/fluxcd/notification-controller/api v1.6.0 h1:t0k662zxnUZlnDvFrk4DBDl6iivFmJxbwuRdyhH9Ot4=
125+
github.com/fluxcd/notification-controller/api v1.6.0/go.mod h1:b1gwfsygqnasQVdn/iMCFDI81LeOeY/ibLul+Z6W8U0=
126126
github.com/fluxcd/pkg/apis/acl v0.7.0 h1:dMhZJH+g6ZRPjs4zVOAN9vHBd1DcavFgcIFkg5ooOE0=
127127
github.com/fluxcd/pkg/apis/acl v0.7.0/go.mod h1:uv7pXXR/gydiX4MUwlQa7vS8JONEDztynnjTvY3JxKQ=
128128
github.com/fluxcd/pkg/apis/event v0.17.0 h1:foEINE++pCJlWVhWjYDXfkVmGKu8mQ4BDBlbYi5NU7M=
@@ -143,8 +143,8 @@ github.com/fluxcd/pkg/ssh v0.18.0 h1:SB0RrZ/YZIla3chTUulsfVmiCzJv5pEWfHM3dHMC8AU
143143
github.com/fluxcd/pkg/ssh v0.18.0/go.mod h1:G5o0ZD7iR3KFoG5gPnFelX243ciI/PIiVW7J4eBrt5Y=
144144
github.com/fluxcd/pkg/version v0.7.0 h1:jZT5I6WFy1KlM40nHCSqlHmjC1VT1/DfmbAdOkIVVJc=
145145
github.com/fluxcd/pkg/version v0.7.0/go.mod h1:3BjQDJXIZJmeJLXnfa2yG/sNAT1t5oeLAPfnSjOHNuA=
146-
github.com/fluxcd/source-controller/api v1.5.0 h1:caSR+u/r2Vh0jq/0pNR0r1zLxyvgatWuGSV2mxgTB/I=
147-
github.com/fluxcd/source-controller/api v1.5.0/go.mod h1:OZPuHMlLH2E2mnj6Q5DLkWfUOmJ20zA1LIvUVfNsYl8=
146+
github.com/fluxcd/source-controller/api v1.6.0 h1:IxfjUczJ2pzbXIef6iQ0RHEH4AYA9anJfTGK8dzwODM=
147+
github.com/fluxcd/source-controller/api v1.6.0/go.mod h1:ZJcAi0nemsnBxjVgmJl0WQzNvB0rMETxQMTdoFosmMw=
148148
github.com/fluxcd/test-infra/tftestenv v0.0.0-20250519112614-4450eea17b00 h1:hU0IM9zG6xaasycHPOPdUlDLtg6tfN1bZ8GTv4iwkRQ=
149149
github.com/fluxcd/test-infra/tftestenv v0.0.0-20250519112614-4450eea17b00/go.mod h1:liFlLEXgambGVdWSJ4JzbIHf1Vjpp1HwUyPazPIVZug=
150150
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
@@ -456,8 +456,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY
456456
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
457457
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
458458
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
459-
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
460-
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
459+
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
460+
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
461461
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
462462
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
463463
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

0 commit comments

Comments
 (0)