@@ -143,9 +143,9 @@ spec:
143143
144144will result in commits with the author ` Fluxbot <[email protected] >`. 145145
146- The `messageTemplate` field is a string which will be used as the commit message. If empty, there is
147- a default message; but you will likely want to provide your own, especially if you want to put
148- tokens in to control how CI reacts to commits made by automation. For example,
146+ The `messageTemplate` field is a string which will be used as a template for the commit message. If
147+ empty, there is a default message; but you will likely want to provide your own, especially if you
148+ want to put tokens in to control how CI reacts to commits made by automation. For example,
149149
150150` ` ` yaml
151151spec:
@@ -158,7 +158,8 @@ spec:
158158
159159# ## Commit template data
160160
161- The data available to the commit message template have this structure (not reproduced verbatim) :
161+ The message template is a [Go text template][go-text-template]. The data available to the template
162+ have this structure (not reproduced verbatim) :
162163
163164` ` ` go
164165// controllers/imageupdateautomation_controller.go
@@ -231,27 +232,28 @@ func (r Result) Objects() map[ObjectIdentifier][]ImageRef {
231232The methods let you range over the objects and images without descending the data structure. Here's
232233an example of using the fields and methods in a template :
233234
234- ` ` ` go
235- commitTemplate := `
236- ` Automated image update
237-
238- Automation name: {{ .AutomationObject }}
239-
240- Files:
241- {{ range $filename, $_ := .Updated.Files -}}
242- - {{ $filename }}
243- {{ end -}}
244-
245- Objects:
246- {{ range $resource, $_ := .Updated.Objects -}}
247- - {{ $resource.Kind }} {{ $resource.Name }}
248- {{ end -}}
249-
250- Images:
251- {{ range .Updated.Images -}}
252- - {{.}}
253- {{ end -}}
254- `
235+ ` ` ` yaml
236+ spec:
237+ commit:
238+ messsageTemplate: |
239+ Automated image update
240+
241+ Automation name: {{ .AutomationObject }}
242+
243+ Files:
244+ {{ range $filename, $_ := .Updated.Files -}}
245+ - {{ $filename }}
246+ {{ end -}}
247+
248+ Objects:
249+ {{ range $resource, $_ := .Updated.Objects -}}
250+ - {{ $resource.Kind }} {{ $resource.Name }}
251+ {{ end -}}
252+
253+ Images:
254+ {{ range .Updated.Images -}}
255+ - {{.}}
256+ {{ end -}}
255257` ` `
256258
257259# # Status
@@ -295,3 +297,4 @@ resulted in a commit.
295297[ git-repo-ref ] : https://toolkit.fluxcd.io/components/source/gitrepositories/
296298[ durations ] : https://godoc.org/time#ParseDuration
297299[ source-docs ] : https://toolkit.fluxcd.io/components/source/gitrepositories/#git-implementation
300+ [ go-text-template ] : https://golang.org/pkg/text/template/
0 commit comments