@@ -48,6 +48,8 @@ const (
48
48
// Artifact for a Git repository.
49
49
type GitRepositorySpec struct {
50
50
// URL specifies the Git repository URL, it can be an HTTP/S or SSH address.
51
+ // +kubebuilder:validation:MinLength=1
52
+ // +kubebuilder:validation:MaxLength=253
51
53
// +kubebuilder:validation:Pattern="^(http|https|ssh)://.*$"
52
54
// +required
53
55
URL string `json:"url"`
@@ -83,6 +85,8 @@ type GitRepositorySpec struct {
83
85
// Ignore overrides the set of excluded patterns in the .sourceignore format
84
86
// (which is the same as .gitignore). If not provided, a default will be used,
85
87
// consult the documentation for your version to find out what those are.
88
+ // +kubebuilder:validation:MaxLength=253
89
+ // +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$`
86
90
// +optional
87
91
Ignore * string `json:"ignore,omitempty"`
88
92
@@ -124,11 +128,15 @@ type GitRepositoryInclude struct {
124
128
125
129
// FromPath specifies the path to copy contents from, defaults to the root
126
130
// of the Artifact.
131
+ // +kubebuilder:validation:MaxLength=253
132
+ // +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$`
127
133
// +optional
128
134
FromPath string `json:"fromPath"`
129
135
130
136
// ToPath specifies the path to copy contents to, defaults to the name of
131
137
// the GitRepositoryRef.
138
+ // +kubebuilder:validation:MaxLength=253
139
+ // +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$`
132
140
// +optional
133
141
ToPath string `json:"toPath"`
134
142
}
@@ -153,14 +161,20 @@ type GitRepositoryRef struct {
153
161
//
154
162
// When GitRepositorySpec.GitImplementation is set to 'go-git', a shallow
155
163
// clone of the specified branch is performed.
164
+ // +kubebuilder:validation:MaxLength=63
165
+ // +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$`
156
166
// +optional
157
167
Branch string `json:"branch,omitempty"`
158
168
159
169
// Tag to check out, takes precedence over Branch.
170
+ // +kubebuilder:validation:MaxLength=253
171
+ // +kubebuilder:validation:Pattern=`^[\-._0-9]+$`
160
172
// +optional
161
173
Tag string `json:"tag,omitempty"`
162
174
163
175
// SemVer tag expression to check out, takes precedence over Tag.
176
+ // +kubebuilder:validation:MaxLength=63
177
+ // +kubebuilder:validation:Pattern=`^[\-._0-9]+$`
164
178
// +optional
165
179
SemVer string `json:"semver,omitempty"`
166
180
@@ -169,6 +183,8 @@ type GitRepositoryRef struct {
169
183
// When GitRepositorySpec.GitImplementation is set to 'go-git', this can be
170
184
// combined with Branch to shallow clone the branch, in which the commit is
171
185
// expected to exist.
186
+ // +kubebuilder:validation:MaxLength=250
187
+ // +kubebuilder:validation:Pattern=`^([a-zA-Z0-9_\-.\\\/]|\[[0-9]{1,5}\])+$`
172
188
// +optional
173
189
Commit string `json:"commit,omitempty"`
174
190
}
@@ -199,6 +215,8 @@ type GitRepositoryStatus struct {
199
215
// URL is the dynamic fetch link for the latest Artifact.
200
216
// It is provided on a "best effort" basis, and using the precise
201
217
// GitRepositoryStatus.Artifact data is recommended.
218
+ // +kubebuilder:validation:MaxLength=253
219
+ // +kubebuilder:validation:Pattern="^(http|https|ssh)://.*$"
202
220
// +optional
203
221
URL string `json:"url,omitempty"`
204
222
@@ -274,6 +292,7 @@ type GitRepository struct {
274
292
metav1.TypeMeta `json:",inline"`
275
293
metav1.ObjectMeta `json:"metadata,omitempty"`
276
294
295
+ // +kubebuilder:validation:required
277
296
Spec GitRepositorySpec `json:"spec,omitempty"`
278
297
// +kubebuilder:default={"observedGeneration":-1}
279
298
Status GitRepositoryStatus `json:"status,omitempty"`
0 commit comments