Skip to content

Commit 97c7510

Browse files
committed
Add PushSpec to image update automation type
Signed-off-by: Michael Bridgen <[email protected]>
1 parent f45e4a1 commit 97c7510

File tree

3 files changed

+54
-3
lines changed

3 files changed

+54
-3
lines changed

api/v1alpha1/imageupdateautomation_types.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,16 @@ type ImageUpdateAutomationSpec struct {
3939
// value.
4040
// +kubebuilder:default={"strategy":"Setters"}
4141
Update *UpdateStrategy `json:"update,omitempty"`
42-
// Commit specifies how to commit to the git repo
42+
// Commit specifies how to commit to the git repository.
4343
// +required
4444
Commit CommitSpec `json:"commit"`
4545

46+
// Push specifies how and where to push commits made by the
47+
// automation. If missing, commits are pushed (back) to
48+
// `.spec.checkout.branch`.
49+
// +optional
50+
Push *PushSpec `json:"push,omitempty"`
51+
4652
// Suspend tells the controller to not run this automation, until
4753
// it is unset (or set to false). Defaults to false.
4854
// +optional
@@ -54,7 +60,9 @@ type GitCheckoutSpec struct {
5460
// to a git repository to update files in.
5561
// +required
5662
GitRepositoryRef meta.LocalObjectReference `json:"gitRepositoryRef"`
57-
// Branch gives the branch to clone from the git repository.
63+
// Branch gives the branch to clone from the git repository. If
64+
// `.spec.push` is not supplied, commits will also be pushed to
65+
// this branch.
5866
// +required
5967
Branch string `json:"branch"`
6068
}
@@ -95,6 +103,15 @@ type CommitSpec struct {
95103
MessageTemplate string `json:"messageTemplate,omitempty"`
96104
}
97105

106+
// PushSpec specifies how and where to push commits.
107+
type PushSpec struct {
108+
// Branch specifies that commits should be pushed to the branch
109+
// named. The branch is created using `.spec.checkout.branch` as the
110+
// starting point, if it doesn't already exist.
111+
// +required
112+
Branch string `json:"branch"`
113+
}
114+
98115
// ImageUpdateAutomationStatus defines the observed state of ImageUpdateAutomation
99116
type ImageUpdateAutomationStatus struct {
100117
// LastAutomationRunTime records the last time the controller ran

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/image.toolkit.fluxcd.io_imageupdateautomations.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ spec:
4747
properties:
4848
branch:
4949
description: Branch gives the branch to clone from the git repository.
50+
If `.spec.push` is not supplied, commits will also be pushed
51+
to this branch.
5052
type: string
5153
gitRepositoryRef:
5254
description: GitRepositoryRef refers to the resource giving access
@@ -63,7 +65,7 @@ spec:
6365
- gitRepositoryRef
6466
type: object
6567
commit:
66-
description: Commit specifies how to commit to the git repo
68+
description: Commit specifies how to commit to the git repository.
6769
properties:
6870
authorEmail:
6971
description: AuthorEmail gives the email to provide when making
@@ -86,6 +88,18 @@ spec:
8688
description: Interval gives an lower bound for how often the automation
8789
run should be attempted.
8890
type: string
91+
push:
92+
description: Push specifies how and where to push commits made by
93+
the automation. If missing, commits are pushed (back) to `.spec.checkout.branch`.
94+
properties:
95+
branch:
96+
description: Branch specifies that commits should be pushed to
97+
the branch named. The branch is created using `.spec.checkout.branch`
98+
as the starting point, if it doesn't already exist.
99+
type: string
100+
required:
101+
- branch
102+
type: object
89103
suspend:
90104
description: Suspend tells the controller to not run this automation,
91105
until it is unset (or set to false). Defaults to false.

0 commit comments

Comments
 (0)