diff --git a/internal/builder/v1alpha1/pipeline.go b/internal/builder/v1alpha1/pipeline.go index 9cb4c778e0a..a1c4acc9189 100644 --- a/internal/builder/v1alpha1/pipeline.go +++ b/internal/builder/v1alpha1/pipeline.go @@ -609,7 +609,7 @@ func PipelineResourceSpecSecretParam(fieldname, secretName, secretKey string) Pi func PipelineWorkspaceDeclaration(names ...string) PipelineSpecOp { return func(spec *v1alpha1.PipelineSpec) { for _, name := range names { - spec.Workspaces = append(spec.Workspaces, v1alpha1.WorkspacePipelineDeclaration{Name: name}) + spec.Workspaces = append(spec.Workspaces, v1alpha1.PipelineWorkspaceDeclaration{Name: name}) } } } diff --git a/internal/builder/v1alpha1/pipeline_test.go b/internal/builder/v1alpha1/pipeline_test.go index 100b4ce7182..8227fc7bba0 100644 --- a/internal/builder/v1alpha1/pipeline_test.go +++ b/internal/builder/v1alpha1/pipeline_test.go @@ -145,7 +145,7 @@ func TestPipeline(t *testing.T) { }}}, }}, }}, - Workspaces: []v1alpha1.WorkspacePipelineDeclaration{{ + Workspaces: []v1alpha1.PipelineWorkspaceDeclaration{{ Name: "workspace1", }}, }, diff --git a/internal/builder/v1beta1/pipeline.go b/internal/builder/v1beta1/pipeline.go index 51c05d1b471..72420ee2534 100644 --- a/internal/builder/v1beta1/pipeline.go +++ b/internal/builder/v1beta1/pipeline.go @@ -541,7 +541,7 @@ func PipelineRunTaskRunsStatus(taskRunName string, status *v1beta1.PipelineRunTa func PipelineWorkspaceDeclaration(names ...string) PipelineSpecOp { return func(spec *v1beta1.PipelineSpec) { for _, name := range names { - spec.Workspaces = append(spec.Workspaces, v1beta1.WorkspacePipelineDeclaration{Name: name}) + spec.Workspaces = append(spec.Workspaces, v1beta1.PipelineWorkspaceDeclaration{Name: name}) } } } diff --git a/internal/builder/v1beta1/pipeline_test.go b/internal/builder/v1beta1/pipeline_test.go index 29d33446cbb..45fdc0b3ae2 100644 --- a/internal/builder/v1beta1/pipeline_test.go +++ b/internal/builder/v1beta1/pipeline_test.go @@ -144,7 +144,7 @@ func TestPipeline(t *testing.T) { }}}, }, }}, - Workspaces: []v1beta1.WorkspacePipelineDeclaration{{ + Workspaces: []v1beta1.PipelineWorkspaceDeclaration{{ Name: "workspace1", }}, }, diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go b/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go index 1a38d6e3dab..f4d54a41cda 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go @@ -71,7 +71,7 @@ func TestPipelineConversion(t *testing.T) { Type: v1beta1.ParamTypeString, Description: "My first param", }}, - Workspaces: []WorkspacePipelineDeclaration{{ + Workspaces: []PipelineWorkspaceDeclaration{{ Name: "workspace1", }}, Tasks: []PipelineTask{{ diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_types.go b/pkg/apis/pipeline/v1alpha1/pipeline_types.go index 0c3968d1089..0fe65aaae43 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_types.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_types.go @@ -39,7 +39,7 @@ type PipelineSpec struct { // Workspaces declares a set of named workspaces that are expected to be // provided by a PipelineRun. // +optional - Workspaces []WorkspacePipelineDeclaration `json:"workspaces,omitempty"` + Workspaces []PipelineWorkspaceDeclaration `json:"workspaces,omitempty"` // Results are values that this pipeline can output once run // +optional Results []PipelineResult `json:"results,omitempty"` diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_validation.go b/pkg/apis/pipeline/v1alpha1/pipeline_validation.go index 9afe435d72f..7a10048388a 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_validation.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_validation.go @@ -231,7 +231,7 @@ func validatePipelineTaskName(ctx context.Context, prefix string, i int, t Pipel return nil } -func validatePipelineWorkspaces(wss []WorkspacePipelineDeclaration, pts []PipelineTask) *apis.FieldError { +func validatePipelineWorkspaces(wss []PipelineWorkspaceDeclaration, pts []PipelineTask) *apis.FieldError { // Workspace names must be non-empty and unique. wsTable := make(map[string]struct{}) for i, ws := range wss { diff --git a/pkg/apis/pipeline/v1alpha1/workspace_types.go b/pkg/apis/pipeline/v1alpha1/workspace_types.go index 1d9650c45b4..4dfd2c5a67b 100644 --- a/pkg/apis/pipeline/v1alpha1/workspace_types.go +++ b/pkg/apis/pipeline/v1alpha1/workspace_types.go @@ -26,9 +26,9 @@ type WorkspaceDeclaration = v1beta1.WorkspaceDeclaration // WorkspaceBinding maps a Task's declared workspace to a Volume. type WorkspaceBinding = v1beta1.WorkspaceBinding -// WorkspacePipelineDeclaration creates a named slot in a Pipeline that a PipelineRun +// PipelineWorkspaceDeclaration creates a named slot in a Pipeline that a PipelineRun // is expected to populate with a workspace binding. -type WorkspacePipelineDeclaration = v1beta1.WorkspacePipelineDeclaration +type PipelineWorkspaceDeclaration = v1beta1.PipelineWorkspaceDeclaration // WorkspacePipelineTaskBinding describes how a workspace passed into the pipeline should be // mapped to a task's declared workspace. diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index 881a01da0e7..1ff0cd3ec07 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -470,7 +470,7 @@ func (in *PipelineSpec) DeepCopyInto(out *PipelineSpec) { } if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces - *out = make([]v1beta1.WorkspacePipelineDeclaration, len(*in)) + *out = make([]v1beta1.PipelineWorkspaceDeclaration, len(*in)) copy(*out, *in) } if in.Results != nil { diff --git a/pkg/apis/pipeline/v1beta1/pipeline_types.go b/pkg/apis/pipeline/v1beta1/pipeline_types.go index 6a4234bf2e1..e1d6b10a91d 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_types.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_types.go @@ -67,7 +67,7 @@ type PipelineSpec struct { // Workspaces declares a set of named workspaces that are expected to be // provided by a PipelineRun. // +optional - Workspaces []WorkspacePipelineDeclaration `json:"workspaces,omitempty"` + Workspaces []PipelineWorkspaceDeclaration `json:"workspaces,omitempty"` // Results are values that this pipeline can output once run // +optional Results []PipelineResult `json:"results,omitempty"` diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation.go b/pkg/apis/pipeline/v1beta1/pipeline_validation.go index ea12e6450a3..1798ad87be3 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation.go @@ -245,7 +245,7 @@ func validatePipelineTaskName(ctx context.Context, prefix string, i int, t Pipel // validatePipelineWorkspaces validates the specified workspaces, ensuring having unique name without any empty string, // and validates that all the referenced workspaces (by pipeline tasks) are specified in the pipeline -func validatePipelineWorkspaces(wss []WorkspacePipelineDeclaration, pts []PipelineTask) *apis.FieldError { +func validatePipelineWorkspaces(wss []PipelineWorkspaceDeclaration, pts []PipelineTask) *apis.FieldError { // Workspace names must be non-empty and unique. wsTable := make(map[string]struct{}) for i, ws := range wss { diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go index 06a3574a77d..f7ba1c519e2 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation_test.go @@ -85,7 +85,7 @@ func TestPipeline_Validate_Success(t *testing.T) { StringVal: "pipeline-default", }, }}, - Workspaces: []WorkspacePipelineDeclaration{{ + Workspaces: []PipelineWorkspaceDeclaration{{ Name: "shared-workspace", Description: "this is my shared workspace", }}, @@ -978,11 +978,11 @@ func TestValidatePipelineParameterVariables_Failure(t *testing.T) { func TestValidatePipelineWorkspaces_Success(t *testing.T) { tests := []struct { name string - workspaces []WorkspacePipelineDeclaration + workspaces []PipelineWorkspaceDeclaration tasks []PipelineTask }{{ name: "unused pipeline spec workspaces do not cause an error", - workspaces: []WorkspacePipelineDeclaration{{ + workspaces: []PipelineWorkspaceDeclaration{{ Name: "foo", }, { Name: "bar", @@ -1004,11 +1004,11 @@ func TestValidatePipelineWorkspaces_Success(t *testing.T) { func TestValidatePipelineWorkspaces_Failure(t *testing.T) { tests := []struct { name string - workspaces []WorkspacePipelineDeclaration + workspaces []PipelineWorkspaceDeclaration tasks []PipelineTask }{{ name: "workspace bindings relying on a non-existent pipeline workspace cause an error", - workspaces: []WorkspacePipelineDeclaration{{ + workspaces: []PipelineWorkspaceDeclaration{{ Name: "foo", }}, tasks: []PipelineTask{{ @@ -1020,7 +1020,7 @@ func TestValidatePipelineWorkspaces_Failure(t *testing.T) { }}, }, { name: "multiple workspaces sharing the same name are not allowed", - workspaces: []WorkspacePipelineDeclaration{{ + workspaces: []PipelineWorkspaceDeclaration{{ Name: "foo", }, { Name: "foo", @@ -1030,7 +1030,7 @@ func TestValidatePipelineWorkspaces_Failure(t *testing.T) { }}, }, { name: "workspace name must not be empty", - workspaces: []WorkspacePipelineDeclaration{{ + workspaces: []PipelineWorkspaceDeclaration{{ Name: "", }}, tasks: []PipelineTask{{ diff --git a/pkg/apis/pipeline/v1beta1/workspace_types.go b/pkg/apis/pipeline/v1beta1/workspace_types.go index 0a47bfaf228..7c64539b87c 100644 --- a/pkg/apis/pipeline/v1beta1/workspace_types.go +++ b/pkg/apis/pipeline/v1beta1/workspace_types.go @@ -76,9 +76,9 @@ type WorkspaceBinding struct { Secret *corev1.SecretVolumeSource `json:"secret,omitempty"` } -// WorkspacePipelineDeclaration creates a named slot in a Pipeline that a PipelineRun +// PipelineWorkspaceDeclaration creates a named slot in a Pipeline that a PipelineRun // is expected to populate with a workspace binding. -type WorkspacePipelineDeclaration struct { +type PipelineWorkspaceDeclaration struct { // Name is the name of a workspace to be provided by a PipelineRun. Name string `json:"name"` // Description is a human readable string describing how the workspace will be diff --git a/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go index a8c0313d3b0..963315c0e20 100644 --- a/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1beta1/zz_generated.deepcopy.go @@ -777,7 +777,7 @@ func (in *PipelineSpec) DeepCopyInto(out *PipelineSpec) { } if in.Workspaces != nil { in, out := &in.Workspaces, &out.Workspaces - *out = make([]WorkspacePipelineDeclaration, len(*in)) + *out = make([]PipelineWorkspaceDeclaration, len(*in)) copy(*out, *in) } if in.Results != nil { @@ -1674,17 +1674,17 @@ func (in *WorkspaceDeclaration) DeepCopy() *WorkspaceDeclaration { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkspacePipelineDeclaration) DeepCopyInto(out *WorkspacePipelineDeclaration) { +func (in *PipelineWorkspaceDeclaration) DeepCopyInto(out *PipelineWorkspaceDeclaration) { *out = *in return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkspacePipelineDeclaration. -func (in *WorkspacePipelineDeclaration) DeepCopy() *WorkspacePipelineDeclaration { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineWorkspaceDeclaration. +func (in *PipelineWorkspaceDeclaration) DeepCopy() *PipelineWorkspaceDeclaration { if in == nil { return nil } - out := new(WorkspacePipelineDeclaration) + out := new(PipelineWorkspaceDeclaration) in.DeepCopyInto(out) return out } diff --git a/test/builder/pipeline_test.go b/test/builder/pipeline_test.go index 100b4ce7182..8227fc7bba0 100644 --- a/test/builder/pipeline_test.go +++ b/test/builder/pipeline_test.go @@ -145,7 +145,7 @@ func TestPipeline(t *testing.T) { }}}, }}, }}, - Workspaces: []v1alpha1.WorkspacePipelineDeclaration{{ + Workspaces: []v1alpha1.PipelineWorkspaceDeclaration{{ Name: "workspace1", }}, }, diff --git a/test/workspace_test.go b/test/workspace_test.go index 78e4573a43c..08f4e9c914f 100644 --- a/test/workspace_test.go +++ b/test/workspace_test.go @@ -135,7 +135,7 @@ func TestWorkspacePipelineRunDuplicateWorkspaceEntriesInvalid(t *testing.T) { pipeline := &v1beta1.Pipeline{ ObjectMeta: metav1.ObjectMeta{Name: pipelineName, Namespace: namespace}, Spec: v1beta1.PipelineSpec{ - Workspaces: []v1beta1.WorkspacePipelineDeclaration{{ + Workspaces: []v1beta1.PipelineWorkspaceDeclaration{{ Name: "foo", }}, Tasks: []v1beta1.PipelineTask{{ @@ -204,7 +204,7 @@ func TestWorkspacePipelineRunMissingWorkspaceInvalid(t *testing.T) { pipeline := &v1beta1.Pipeline{ ObjectMeta: metav1.ObjectMeta{Name: pipelineName, Namespace: namespace}, Spec: v1beta1.PipelineSpec{ - Workspaces: []v1beta1.WorkspacePipelineDeclaration{{ + Workspaces: []v1beta1.PipelineWorkspaceDeclaration{{ Name: "foo", }}, Tasks: []v1beta1.PipelineTask{{