Skip to content

Commit e7f24e3

Browse files
authored
remove project.sparseCheckoutDir (#459)
* remove devfile v2 project.sparseCheckoutDir Signed-off-by: Stephanie <[email protected]> * resolve concersion test failure Signed-off-by: Stephanie <[email protected]> * address review comment on conversion test Signed-off-by: Stephanie <[email protected]>
1 parent c2ce1e9 commit e7f24e3

30 files changed

+18
-259
lines changed

crds/workspace.devfile.io_devworkspaces.v1beta1.yaml

-12
Original file line numberDiff line numberDiff line change
@@ -7012,12 +7012,6 @@ spec:
70127012
- Git
70137013
- Zip
70147014
type: string
7015-
sparseCheckoutDirs:
7016-
description: Populate the project sparsely with selected
7017-
directories.
7018-
items:
7019-
type: string
7020-
type: array
70217015
zip:
70227016
description: Project's Zip source
70237017
properties:
@@ -7203,12 +7197,6 @@ spec:
72037197
- Zip
72047198
- Custom
72057199
type: string
7206-
sparseCheckoutDirs:
7207-
description: Populate the project sparsely with selected
7208-
directories.
7209-
items:
7210-
type: string
7211-
type: array
72127200
zip:
72137201
description: Project's Zip source
72147202
properties:

crds/workspace.devfile.io_devworkspaces.yaml

-12
Original file line numberDiff line numberDiff line change
@@ -7017,12 +7017,6 @@ spec:
70177017
- Git
70187018
- Zip
70197019
type: string
7020-
sparseCheckoutDirs:
7021-
description: Populate the project sparsely with selected
7022-
directories.
7023-
items:
7024-
type: string
7025-
type: array
70267020
zip:
70277021
description: Project's Zip source
70287022
properties:
@@ -7208,12 +7202,6 @@ spec:
72087202
- Zip
72097203
- Custom
72107204
type: string
7211-
sparseCheckoutDirs:
7212-
description: Populate the project sparsely with selected
7213-
directories.
7214-
items:
7215-
type: string
7216-
type: array
72177205
zip:
72187206
description: Project's Zip source
72197207
properties:

crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -6679,12 +6679,6 @@ spec:
66796679
- Git
66806680
- Zip
66816681
type: string
6682-
sparseCheckoutDirs:
6683-
description: Populate the project sparsely with selected
6684-
directories.
6685-
items:
6686-
type: string
6687-
type: array
66886682
zip:
66896683
description: Project's Zip source
66906684
properties:
@@ -6865,11 +6859,6 @@ spec:
68656859
- Zip
68666860
- Custom
68676861
type: string
6868-
sparseCheckoutDirs:
6869-
description: Populate the project sparsely with selected directories.
6870-
items:
6871-
type: string
6872-
type: array
68736862
zip:
68746863
description: Project's Zip source
68756864
properties:

crds/workspace.devfile.io_devworkspacetemplates.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -6684,12 +6684,6 @@ spec:
66846684
- Git
66856685
- Zip
66866686
type: string
6687-
sparseCheckoutDirs:
6688-
description: Populate the project sparsely with selected
6689-
directories.
6690-
items:
6691-
type: string
6692-
type: array
66936687
zip:
66946688
description: Project's Zip source
66956689
properties:
@@ -6870,11 +6864,6 @@ spec:
68706864
- Zip
68716865
- Custom
68726866
type: string
6873-
sparseCheckoutDirs:
6874-
description: Populate the project sparsely with selected directories.
6875-
items:
6876-
type: string
6877-
type: array
68786867
zip:
68796868
description: Project's Zip source
68806869
properties:

pkg/apis/workspaces/v1alpha1/conversion_test.go

+18
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,39 @@ var parentProjectFuzzFunc = func(project *Project, c fuzz.Continue) {
151151
switch c.Intn(3) {
152152
case 0:
153153
c.Fuzz(&project.Git)
154+
if project.Git != nil {
155+
project.Git.SparseCheckoutDir = ""
156+
}
154157
case 1:
155158
c.Fuzz(&project.Github)
159+
if project.Github != nil {
160+
project.Github.SparseCheckoutDir = ""
161+
}
156162
case 2:
157163
c.Fuzz(&project.Zip)
164+
if project.Zip != nil {
165+
project.Zip.SparseCheckoutDir = ""
166+
}
158167
}
159168
}
160169

161170
var projectFuzzFunc = func(project *Project, c fuzz.Continue) {
162171
switch c.Intn(4) {
163172
case 0:
164173
c.Fuzz(&project.Git)
174+
if project.Git != nil {
175+
project.Git.SparseCheckoutDir = ""
176+
}
165177
case 1:
166178
c.Fuzz(&project.Github)
179+
if project.Github != nil {
180+
project.Github.SparseCheckoutDir = ""
181+
}
167182
case 2:
168183
c.Fuzz(&project.Zip)
184+
if project.Zip != nil {
185+
project.Zip.SparseCheckoutDir = ""
186+
}
169187
case 3:
170188
c.Fuzz(&project.Custom)
171189
}

pkg/apis/workspaces/v1alpha1/projects_conversion.go

-25
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ func convertProjectTo_v1alpha2(src *Project, dest *v1alpha2.Project) error {
3232
return err
3333
}
3434

35-
var sparseCheckoutDir string
36-
switch {
37-
case src.Git != nil:
38-
sparseCheckoutDir = src.Git.SparseCheckoutDir
39-
case src.Zip != nil:
40-
sparseCheckoutDir = src.Zip.SparseCheckoutDir
41-
}
42-
if sparseCheckoutDir != "" {
43-
dest.SparseCheckoutDirs = []string{sparseCheckoutDir}
44-
}
45-
4635
// Make sure we didn't modify underlying src struct
4736
if src.Github != nil {
4837
src.Git = nil
@@ -60,20 +49,6 @@ func convertProjectFrom_v1alpha2(src *v1alpha2.Project, dest *Project) error {
6049
if err != nil {
6150
return err
6251
}
63-
// **Note**: These aren't technically compatible:
64-
// - v1alpha2 allows us to specify multiple sparse checkout dirs; v1alpha1 only supports one
65-
// -> we ignore all but the first sparseCheckoutDir
66-
// - v1alpha2 doesn't forbid sparse checkout dir for a custom project source
67-
// -> we ignore all sparseCheckoutDirs when project source is Custom
68-
if len(src.SparseCheckoutDirs) > 0 {
69-
sparseCheckoutDir := src.SparseCheckoutDirs[0]
70-
switch {
71-
case src.Git != nil:
72-
dest.Git.SparseCheckoutDir = sparseCheckoutDir
73-
case src.Zip != nil:
74-
dest.Zip.SparseCheckoutDir = sparseCheckoutDir
75-
}
76-
}
7752

7853
// Check if a Git-type project was originally a Github-type project in v1alpha1
7954
if src.Git != nil && src.Attributes != nil {

pkg/apis/workspaces/v1alpha2/projects.go

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ type Project struct {
1919
// +optional
2020
ClonePath string `json:"clonePath,omitempty"`
2121

22-
// Populate the project sparsely with selected directories.
23-
// +optional
24-
SparseCheckoutDirs []string `json:"sparseCheckoutDirs,omitempty"`
25-
2622
ProjectSource `json:",inline"`
2723
}
2824

pkg/apis/workspaces/v1alpha2/zz_generated.deepcopy.go

-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/workspaces/v1alpha2/zz_generated.parent_overrides.go

-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/validation/variables/test-fixtures/all/devfile-bad-output.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ variables:
33
projects:
44
- name: project1
55
clonePath: "{{path}}"
6-
sparseCheckoutDirs:
7-
- xyz
8-
- "{{dir}}"
96
git:
107
checkoutFrom:
118
revision: "{{tag}}"

pkg/validation/variables/test-fixtures/all/devfile-bad.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ variables:
33
projects:
44
- name: project1
55
clonePath: "{{path}}"
6-
sparseCheckoutDirs:
7-
- xyz
8-
- "{{dir}}"
96
git:
107
checkoutFrom:
118
revision: "{{tag}}"

pkg/validation/variables/test-fixtures/projects/project-output.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: project1
22
clonePath: "/FOO"
3-
sparseCheckoutDirs:
4-
- /FOO
5-
- "/BAR"
63
git:
74
checkoutFrom:
85
revision: "FOO"

pkg/validation/variables/test-fixtures/projects/project.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Variables are defined in test-fixtures/variables/variables-referenced.yaml
22
name: project1
33
clonePath: "/{{foo}}"
4-
sparseCheckoutDirs:
5-
- /FOO
6-
- "/{{bar}}"
74
git:
85
checkoutFrom:
96
revision: "{{foo}}"

pkg/validation/variables/variables_project.go

-7
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ func ValidateAndReplaceForProjects(variables map[string]string, projects []v1alp
2020
checkForInvalidError(invalidKeys, err)
2121
}
2222

23-
// Validate project sparse checkout dir
24-
for j := range projects[i].SparseCheckoutDirs {
25-
if projects[i].SparseCheckoutDirs[j], err = validateAndReplaceDataWithVariable(projects[i].SparseCheckoutDirs[j], variables); err != nil {
26-
checkForInvalidError(invalidKeys, err)
27-
}
28-
}
29-
3023
// Validate project source
3124
if err = validateandReplaceForProjectSource(variables, &projects[i].ProjectSource); err != nil {
3225
checkForInvalidError(invalidKeys, err)

schemas/latest/dev-workspace-template-spec.json

-14
Original file line numberDiff line numberDiff line change
@@ -2594,13 +2594,6 @@
25942594
"maxLength": 63,
25952595
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
25962596
},
2597-
"sparseCheckoutDirs": {
2598-
"description": "Populate the project sparsely with selected directories.",
2599-
"type": "array",
2600-
"items": {
2601-
"type": "string"
2602-
}
2603-
},
26042597
"zip": {
26052598
"description": "Project's Zip source",
26062599
"type": "object",
@@ -2809,13 +2802,6 @@
28092802
"maxLength": 63,
28102803
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
28112804
},
2812-
"sparseCheckoutDirs": {
2813-
"description": "Populate the project sparsely with selected directories.",
2814-
"type": "array",
2815-
"items": {
2816-
"type": "string"
2817-
}
2818-
},
28192805
"zip": {
28202806
"description": "Project's Zip source",
28212807
"type": "object",

schemas/latest/dev-workspace-template.json

-14
Original file line numberDiff line numberDiff line change
@@ -2759,13 +2759,6 @@
27592759
"maxLength": 63,
27602760
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
27612761
},
2762-
"sparseCheckoutDirs": {
2763-
"description": "Populate the project sparsely with selected directories.",
2764-
"type": "array",
2765-
"items": {
2766-
"type": "string"
2767-
}
2768-
},
27692762
"zip": {
27702763
"description": "Project's Zip source",
27712764
"type": "object",
@@ -2974,13 +2967,6 @@
29742967
"maxLength": 63,
29752968
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
29762969
},
2977-
"sparseCheckoutDirs": {
2978-
"description": "Populate the project sparsely with selected directories.",
2979-
"type": "array",
2980-
"items": {
2981-
"type": "string"
2982-
}
2983-
},
29842970
"zip": {
29852971
"description": "Project's Zip source",
29862972
"type": "object",

schemas/latest/dev-workspace.json

-14
Original file line numberDiff line numberDiff line change
@@ -2772,13 +2772,6 @@
27722772
"maxLength": 63,
27732773
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
27742774
},
2775-
"sparseCheckoutDirs": {
2776-
"description": "Populate the project sparsely with selected directories.",
2777-
"type": "array",
2778-
"items": {
2779-
"type": "string"
2780-
}
2781-
},
27822775
"zip": {
27832776
"description": "Project's Zip source",
27842777
"type": "object",
@@ -2987,13 +2980,6 @@
29872980
"maxLength": 63,
29882981
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
29892982
},
2990-
"sparseCheckoutDirs": {
2991-
"description": "Populate the project sparsely with selected directories.",
2992-
"type": "array",
2993-
"items": {
2994-
"type": "string"
2995-
}
2996-
},
29972983
"zip": {
29982984
"description": "Project's Zip source",
29992985
"type": "object",

schemas/latest/devfile.json

-14
Original file line numberDiff line numberDiff line change
@@ -1354,13 +1354,6 @@
13541354
"maxLength": 63,
13551355
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
13561356
},
1357-
"sparseCheckoutDirs": {
1358-
"description": "Populate the project sparsely with selected directories.",
1359-
"type": "array",
1360-
"items": {
1361-
"type": "string"
1362-
}
1363-
},
13641357
"zip": {
13651358
"description": "Project's Zip source",
13661359
"type": "object",
@@ -1546,13 +1539,6 @@
15461539
"maxLength": 63,
15471540
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
15481541
},
1549-
"sparseCheckoutDirs": {
1550-
"description": "Populate the project sparsely with selected directories.",
1551-
"type": "array",
1552-
"items": {
1553-
"type": "string"
1554-
}
1555-
},
15561542
"zip": {
15571543
"description": "Project's Zip source",
15581544
"type": "object",

0 commit comments

Comments
 (0)