Skip to content

Commit c9db552

Browse files
committed
git: fix reference json serialization
- add omitempty to GitRepositoryRef fields
1 parent f2bff90 commit c9db552

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

api/v1alpha1/gitrepository_types.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ type GitRepositorySpec struct {
4242
// +required
4343
Interval metav1.Duration `json:"interval"`
4444

45-
// The timeout for remote git operations like cloning.
46-
// +kubebuilder:validation:Default=20s
45+
// The timeout for remote git operations like cloning, default to 20s.
4746
// +optional
4847
Timeout *metav1.Duration `json:"timeout,omitempty"`
4948

@@ -61,20 +60,19 @@ type GitRepositorySpec struct {
6160
type GitRepositoryRef struct {
6261
// The git branch to checkout, defaults to master.
6362
// +optional
64-
Branch string `json:"branch"`
63+
Branch string `json:"branch,omitempty"`
6564

6665
// The git tag to checkout, takes precedence over branch.
6766
// +optional
68-
Tag string `json:"tag"`
67+
Tag string `json:"tag,omitempty"`
6968

7069
// The git tag semver expression, takes precedence over tag.
7170
// +optional
72-
SemVer string `json:"semver"`
71+
SemVer string `json:"semver,omitempty"`
7372

74-
// The git commit sha to checkout, if specified tag filters will be
75-
// ignored.
73+
// The git commit sha to checkout, if specified tag filters will be ignored.
7674
// +optional
77-
Commit string `json:"commit"`
75+
Commit string `json:"commit,omitempty"`
7876
}
7977

8078
// GitRepositoryVerification defines the OpenPGP signature verification process.

config/crd/bases/source.fluxcd.io_gitrepositories.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ spec:
8383
type: string
8484
type: object
8585
timeout:
86-
description: The timeout for remote git operations like cloning.
86+
description: The timeout for remote git operations like cloning, default
87+
to 20s.
8788
type: string
8889
url:
8990
description: The repository URL, can be a HTTP or SSH address.

docs/spec/v1alpha1/gitrepositories.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ type GitRepositorySpec struct {
2727
// The interval at which to check for repository updates.
2828
Interval metav1.Duration `json:"interval"`
2929

30-
// The timeout for remote git operations like cloning.
31-
// +kubebuilder:validation:Default=20s
30+
// The timeout for remote git operations like cloning, default to 20s.
3231
// +optional
3332
Timeout *metav1.Duration `json:"timeout,omitempty"`
3433

@@ -50,20 +49,19 @@ Git repository reference:
5049
type GitRepositoryRef struct {
5150
// The git branch to checkout, defaults to master.
5251
// +optional
53-
Branch string `json:"branch"`
52+
Branch string `json:"branch,omitempty"`
5453

5554
// The git tag to checkout, takes precedence over branch.
5655
// +optional
57-
Tag string `json:"tag"`
56+
Tag string `json:"tag,omitempty"`
5857

5958
// The git tag semver expression, takes precedence over tag.
6059
// +optional
61-
SemVer string `json:"semver"`
60+
SemVer string `json:"semver,omitempty"`
6261

63-
// The git commit sha to checkout, if specified branch and tag filters will
64-
// ignored.
62+
// The git commit sha to checkout, if specified tag filters will be ignored.
6563
// +optional
66-
Commit string `json:"commit"`
64+
Commit string `json:"commit,omitempty"`
6765
}
6866
```
6967

0 commit comments

Comments
 (0)