Skip to content

Commit 076758a

Browse files
committed
Explain how the push field works
Signed-off-by: Michael Bridgen <[email protected]>
1 parent 8f3e358 commit 076758a

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

docs/spec/v1alpha1/imageupdateautomations.md

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,24 @@ type ImageUpdateAutomationSpec struct {
2727
// value.
2828
// +kubebuilder:default={"strategy":"Setters"}
2929
Update *UpdateStrategy `json:"update,omitempty"`
30-
// Commit specifies how to commit to the git repo
30+
// Commit specifies how to commit to the git repository.
3131
// +required
3232
Commit CommitSpec `json:"commit"`
3333

34+
// Push specifies how and where to push commits made by the
35+
// automation. If missing, commits are pushed (back) to
36+
// `.spec.checkout.branch`.
37+
// +optional
38+
Push *PushSpec `json:"push,omitempty"`
39+
3440
// Suspend tells the controller to not run this automation, until
3541
// it is unset (or set to false). Defaults to false.
3642
// +optional
3743
Suspend bool `json:"suspend,omitempty"`
3844
}
3945
```
4046

41-
See the sections below, regarding `checkout`, `update`, and `commit`.
47+
See the sections below regarding `checkout`, `update`, `commit`, and `push`.
4248

4349
The required `interval` field gives a period for automation runs, in [duration notation][durations];
4450
e.g., `"5m"`.
@@ -67,8 +73,8 @@ with write access; e.g., if using a GitHub deploy key, "Allow write access" shou
6773
creating it. Only the `url`, `secretRef` and `gitImplementation` (see just below) fields of the
6874
`GitRepository` are used.
6975

70-
The `branch` field names the branch in the git repository to check out; this will also be the branch
71-
the controller pushes commits to.
76+
The `branch` field names the branch in the git repository to check out. When the `push` field is not
77+
present (see [below](#push)), this will also be the branch pushed back to the origin repository.
7278

7379
**Git implementation**
7480

@@ -256,6 +262,28 @@ spec:
256262
{{ end -}}
257263
```
258264

265+
## Push
266+
267+
The optional `push` field defines how commits are pushed to the origin.
268+
269+
```go
270+
// PushSpec specifies how and where to push commits.
271+
type PushSpec struct {
272+
// Branch specifies that commits should be pushed to the branch
273+
// named. The branch is created using `.spec.checkout.branch` as the
274+
// starting point, if it doesn't already exist.
275+
// +required
276+
Branch string `json:"branch"`
277+
}
278+
```
279+
280+
If `push` is not present, commits are made on the same branch as `.checkout.branch` and pushed to
281+
the same branch at the origin.
282+
283+
When `push` is present, the `push.branch` field specifies a branch to push to at the origin. The
284+
branch will be created locally if it does not already exist, starting from `.checkout.branch`. If it
285+
does already exist, updates will be calculated on top of any commits already on the branch.
286+
259287
## Status
260288

261289
The status of an `ImageUpdateAutomation` object records the result of the last automation run.

0 commit comments

Comments
 (0)