Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9f9d1bd

Browse files
committedApr 27, 2020
Allow subPath in PipelineRun for volumeClaimTemplate as well
1 parent bd8cfa3 commit 9f9d1bd

4 files changed

+0
-43
lines changed
 

‎pkg/apis/pipeline/v1beta1/pipelinerun_validation.go

-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ func (ps *PipelineRunSpec) Validate(ctx context.Context) *apis.FieldError {
8181
}
8282
}
8383
wsNames[ws.Name] = idx
84-
85-
if err := ws.Validate(ctx); err != nil {
86-
return err
87-
}
8884
}
8985
}
9086

‎pkg/apis/pipeline/v1beta1/pipelinerun_validation_test.go

-16
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,6 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
196196
Message: `workspace "ws" provided by pipelinerun more than once, at index 0 and 1`,
197197
Paths: []string{"spec.workspaces"},
198198
},
199-
}, {
200-
name: "workspace with volumeClaimTemplate can not contain subPath field",
201-
spec: v1beta1.PipelineRunSpec{
202-
PipelineRef: &v1beta1.PipelineRef{
203-
Name: "pipelinerefname",
204-
},
205-
Workspaces: []v1beta1.WorkspaceBinding{{
206-
Name: "ws",
207-
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{},
208-
SubPath: "subdir",
209-
}},
210-
},
211-
wantErr: &apis.FieldError{
212-
Message: `must not set the field(s)`,
213-
Paths: []string{"workspaces.volumeclaimtemplate.subpath"},
214-
},
215199
}}
216200
for _, ps := range tests {
217201
t.Run(ps.name, func(t *testing.T) {

‎pkg/apis/pipeline/v1beta1/workspace_validation.go

-4
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ func (b *WorkspaceBinding) Validate(ctx context.Context) *apis.FieldError {
5656
return apis.ErrMissingField("workspace.persistentvolumeclaim.claimname")
5757
}
5858

59-
if b.VolumeClaimTemplate != nil && b.SubPath != "" {
60-
return apis.ErrDisallowedFields("workspaces.volumeclaimtemplate.subpath")
61-
}
62-
6359
// For a ConfigMap to work, you must provide the name of the ConfigMap to use.
6460
if b.ConfigMap != nil && b.ConfigMap.LocalObjectReference.Name == "" {
6561
return apis.ErrMissingField("workspace.configmap.name")

‎pkg/apis/pipeline/v1beta1/workspace_validation_test.go

-19
Original file line numberDiff line numberDiff line change
@@ -105,25 +105,6 @@ func TestWorkspaceBindingValidateInvalid(t *testing.T) {
105105
ClaimName: "pool-party",
106106
},
107107
},
108-
}, {
109-
name: "Provided volumeClaimTemplate with subPath field set",
110-
binding: &WorkspaceBinding{
111-
Name: "beth",
112-
SubPath: "notallowed-when-using-volumeclaimtemplate-in-pipeline",
113-
VolumeClaimTemplate: &corev1.PersistentVolumeClaim{
114-
ObjectMeta: metav1.ObjectMeta{
115-
Name: "mypvc",
116-
},
117-
Spec: corev1.PersistentVolumeClaimSpec{
118-
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},
119-
Resources: corev1.ResourceRequirements{
120-
Requests: corev1.ResourceList{
121-
"storage": resource.MustParse("1Gi"),
122-
},
123-
},
124-
},
125-
},
126-
},
127108
}, {
128109
name: "Provided neither pvc nor emptydir",
129110
binding: &WorkspaceBinding{

0 commit comments

Comments
 (0)
Please sign in to comment.