Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove project.sparseCheckoutDir #459

Merged
merged 3 commits into from
May 19, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions crds/workspace.devfile.io_devworkspaces.v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7012,12 +7012,6 @@ spec:
- Git
- Zip
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected
directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down Expand Up @@ -7203,12 +7197,6 @@ spec:
- Zip
- Custom
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected
directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down
12 changes: 0 additions & 12 deletions crds/workspace.devfile.io_devworkspaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7017,12 +7017,6 @@ spec:
- Git
- Zip
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected
directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down Expand Up @@ -7208,12 +7202,6 @@ spec:
- Zip
- Custom
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected
directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down
11 changes: 0 additions & 11 deletions crds/workspace.devfile.io_devworkspacetemplates.v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6679,12 +6679,6 @@ spec:
- Git
- Zip
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected
directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down Expand Up @@ -6865,11 +6859,6 @@ spec:
- Zip
- Custom
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down
11 changes: 0 additions & 11 deletions crds/workspace.devfile.io_devworkspacetemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6684,12 +6684,6 @@ spec:
- Git
- Zip
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected
directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down Expand Up @@ -6870,11 +6864,6 @@ spec:
- Zip
- Custom
type: string
sparseCheckoutDirs:
description: Populate the project sparsely with selected directories.
items:
type: string
type: array
zip:
description: Project's Zip source
properties:
Expand Down
18 changes: 18 additions & 0 deletions pkg/apis/workspaces/v1alpha1/conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,39 @@ var parentProjectFuzzFunc = func(project *Project, c fuzz.Continue) {
switch c.Intn(3) {
case 0:
c.Fuzz(&project.Git)
if project.Git != nil {
project.Git.CommonProjectSource = CommonProjectSource{}
}
case 1:
c.Fuzz(&project.Github)
if project.Github != nil {
project.Github.CommonProjectSource = CommonProjectSource{}
}
case 2:
c.Fuzz(&project.Zip)
if project.Zip != nil {
project.Zip.CommonProjectSource = CommonProjectSource{}
}
}
}

var projectFuzzFunc = func(project *Project, c fuzz.Continue) {
switch c.Intn(4) {
case 0:
c.Fuzz(&project.Git)
if project.Git != nil {
project.Git.CommonProjectSource = CommonProjectSource{}
}
amisevsk marked this conversation as resolved.
Show resolved Hide resolved
case 1:
c.Fuzz(&project.Github)
if project.Github != nil {
project.Github.CommonProjectSource = CommonProjectSource{}
}
case 2:
c.Fuzz(&project.Zip)
if project.Zip != nil {
project.Zip.CommonProjectSource = CommonProjectSource{}
}
case 3:
c.Fuzz(&project.Custom)
}
Expand Down
25 changes: 0 additions & 25 deletions pkg/apis/workspaces/v1alpha1/projects_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,6 @@ func convertProjectTo_v1alpha2(src *Project, dest *v1alpha2.Project) error {
return err
}

var sparseCheckoutDir string
switch {
case src.Git != nil:
sparseCheckoutDir = src.Git.SparseCheckoutDir
case src.Zip != nil:
sparseCheckoutDir = src.Zip.SparseCheckoutDir
}
if sparseCheckoutDir != "" {
dest.SparseCheckoutDirs = []string{sparseCheckoutDir}
}

// Make sure we didn't modify underlying src struct
if src.Github != nil {
src.Git = nil
Expand All @@ -60,20 +49,6 @@ func convertProjectFrom_v1alpha2(src *v1alpha2.Project, dest *Project) error {
if err != nil {
return err
}
// **Note**: These aren't technically compatible:
// - v1alpha2 allows us to specify multiple sparse checkout dirs; v1alpha1 only supports one
// -> we ignore all but the first sparseCheckoutDir
// - v1alpha2 doesn't forbid sparse checkout dir for a custom project source
// -> we ignore all sparseCheckoutDirs when project source is Custom
if len(src.SparseCheckoutDirs) > 0 {
sparseCheckoutDir := src.SparseCheckoutDirs[0]
switch {
case src.Git != nil:
dest.Git.SparseCheckoutDir = sparseCheckoutDir
case src.Zip != nil:
dest.Zip.SparseCheckoutDir = sparseCheckoutDir
}
}

// Check if a Git-type project was originally a Github-type project in v1alpha1
if src.Git != nil && src.Attributes != nil {
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/workspaces/v1alpha2/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ type Project struct {
// +optional
ClonePath string `json:"clonePath,omitempty"`

// Populate the project sparsely with selected directories.
// +optional
SparseCheckoutDirs []string `json:"sparseCheckoutDirs,omitempty"`

ProjectSource `json:",inline"`
}

Expand Down
10 changes: 0 additions & 10 deletions pkg/apis/workspaces/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ variables:
projects:
- name: project1
clonePath: "{{path}}"
sparseCheckoutDirs:
- xyz
- "{{dir}}"
git:
checkoutFrom:
revision: "{{tag}}"
Expand Down
3 changes: 0 additions & 3 deletions pkg/validation/variables/test-fixtures/all/devfile-bad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ variables:
projects:
- name: project1
clonePath: "{{path}}"
sparseCheckoutDirs:
- xyz
- "{{dir}}"
git:
checkoutFrom:
revision: "{{tag}}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: project1
clonePath: "/FOO"
sparseCheckoutDirs:
- /FOO
- "/BAR"
git:
checkoutFrom:
revision: "FOO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Variables are defined in test-fixtures/variables/variables-referenced.yaml
name: project1
clonePath: "/{{foo}}"
sparseCheckoutDirs:
- /FOO
- "/{{bar}}"
git:
checkoutFrom:
revision: "{{foo}}"
Expand Down
7 changes: 0 additions & 7 deletions pkg/validation/variables/variables_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ func ValidateAndReplaceForProjects(variables map[string]string, projects []v1alp
checkForInvalidError(invalidKeys, err)
}

// Validate project sparse checkout dir
for j := range projects[i].SparseCheckoutDirs {
if projects[i].SparseCheckoutDirs[j], err = validateAndReplaceDataWithVariable(projects[i].SparseCheckoutDirs[j], variables); err != nil {
checkForInvalidError(invalidKeys, err)
}
}

// Validate project source
if err = validateandReplaceForProjectSource(variables, &projects[i].ProjectSource); err != nil {
checkForInvalidError(invalidKeys, err)
Expand Down
14 changes: 0 additions & 14 deletions schemas/latest/dev-workspace-template-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2594,13 +2594,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down Expand Up @@ -2809,13 +2802,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down
14 changes: 0 additions & 14 deletions schemas/latest/dev-workspace-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2759,13 +2759,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down Expand Up @@ -2974,13 +2967,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down
14 changes: 0 additions & 14 deletions schemas/latest/dev-workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -2772,13 +2772,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down Expand Up @@ -2987,13 +2980,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down
14 changes: 0 additions & 14 deletions schemas/latest/devfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -1354,13 +1354,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down Expand Up @@ -1546,13 +1539,6 @@
"maxLength": 63,
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
},
"sparseCheckoutDirs": {
"description": "Populate the project sparsely with selected directories.",
"type": "array",
"items": {
"type": "string"
}
},
"zip": {
"description": "Project's Zip source",
"type": "object",
Expand Down
Loading