diff --git a/pkg/cmd/clustertask/describe.go b/pkg/cmd/clustertask/describe.go index e0a6fb5e0f..af038f6f84 100644 --- a/pkg/cmd/clustertask/describe.go +++ b/pkg/cmd/clustertask/describe.go @@ -16,7 +16,6 @@ package clustertask import ( "fmt" - "sort" "text/tabwriter" "text/template" @@ -46,27 +45,6 @@ const describeTemplate = `{{decorate "bold" "Name"}}: {{ .ClusterTask.Name }} {{- end }} {{- end }} -{{- if .ClusterTask.Spec.Resources }} - -{{decorate "inputresources" ""}}{{decorate "underline bold" "Input Resources\n"}} -{{- if ne (len .ClusterTask.Spec.Resources.Inputs) 0 }} - NAME TYPE -{{- range $ir := .ClusterTask.Spec.Resources.Inputs }} - {{decorate "bullet" $ir.Name }} {{ $ir.Type }} -{{- end }} -{{- end }} - -{{- if ne (len .ClusterTask.Spec.Resources.Outputs) 0 }} - -{{decorate "outputresources" ""}}{{decorate "underline bold" "Output Resources\n"}} - NAME TYPE -{{- range $or := .ClusterTask.Spec.Resources.Outputs }} - {{decorate "bullet" $or.Name }} {{ $or.Type }} -{{- end }} -{{- end }} - -{{- end }} - {{- if ne (len .ClusterTask.Spec.Params) 0 }} {{decorate "params" ""}}{{decorate "underline bold" "Params\n"}} @@ -197,11 +175,6 @@ func printClusterTaskDescription(s *cli.Stream, cs *cli.Clients, ctname, namespa return fmt.Errorf("failed to get ClusterTask %s", ctname) } - if clustertask.Spec.Resources != nil { - clustertask.Spec.Resources.Inputs = sortResourcesByTypeAndName(clustertask.Spec.Resources.Inputs) - clustertask.Spec.Resources.Outputs = sortResourcesByTypeAndName(clustertask.Spec.Resources.Outputs) - } - opts := metav1.ListOptions{ LabelSelector: fmt.Sprintf("tekton.dev/clusterTask=%s", ctname), } @@ -242,23 +215,6 @@ func printClusterTaskDescription(s *cli.Stream, cs *cli.Clients, ctname, namespa return w.Flush() } -// this will sort the ClusterTask Resource by Type and then by Name -func sortResourcesByTypeAndName(tres []v1beta1.TaskResource) []v1beta1.TaskResource { - sort.Slice(tres, func(i, j int) bool { - if tres[j].Type < tres[i].Type { - return false - } - - if tres[j].Type > tres[i].Type { - return true - } - - return tres[j].Name > tres[i].Name - }) - - return tres -} - func askClusterTaskName(opts *options.DescribeOptions, clusterTaskNames []string) error { if len(clusterTaskNames) == 0 { return fmt.Errorf("no ClusterTasks found") diff --git a/pkg/cmd/clustertask/describe_test.go b/pkg/cmd/clustertask/describe_test.go index e5562337bc..debdc0e9e4 100644 --- a/pkg/cmd/clustertask/describe_test.go +++ b/pkg/cmd/clustertask/describe_test.go @@ -45,30 +45,6 @@ func Test_ClusterTaskDescribe(t *testing.T) { CreationTimestamp: metav1.Time{Time: clock.Now().Add(1 * time.Minute)}, }, Spec: v1beta1.TaskSpec{ - Resources: &v1beta1.TaskResources{ - Inputs: []v1beta1.TaskResource{ - { - ResourceDeclaration: v1beta1.ResourceDeclaration{ - Name: "my-repo", - Type: v1beta1.PipelineResourceTypeGit, - }, - }, - { - ResourceDeclaration: v1beta1.ResourceDeclaration{ - Name: "my-image", - Type: v1beta1.PipelineResourceTypeImage, - }, - }, - }, - Outputs: []v1beta1.TaskResource{ - { - ResourceDeclaration: v1beta1.ResourceDeclaration{ - Name: "code-image", - Type: v1beta1.PipelineResourceTypeImage, - }, - }, - }, - }, Params: []v1beta1.ParamSpec{ { Name: "myarg", @@ -108,24 +84,6 @@ func Test_ClusterTaskDescribe(t *testing.T) { }, Spec: v1beta1.TaskSpec{ Description: "a test description", - Resources: &v1beta1.TaskResources{ - Inputs: []v1beta1.TaskResource{ - { - ResourceDeclaration: v1beta1.ResourceDeclaration{ - Name: "my-repo", - Type: v1beta1.PipelineResourceTypeGit, - }, - }, - }, - Outputs: []v1beta1.TaskResource{ - { - ResourceDeclaration: v1beta1.ResourceDeclaration{ - Name: "code-image", - Type: v1beta1.PipelineResourceTypeImage, - }, - }, - }, - }, Params: []v1beta1.ParamSpec{ { Name: "myarg", @@ -179,28 +137,6 @@ func Test_ClusterTaskDescribe(t *testing.T) { }, }, }, - Resources: &v1beta1.TaskRunResources{ - Inputs: []v1beta1.TaskResourceBinding{ - { - PipelineResourceBinding: v1beta1.PipelineResourceBinding{ - Name: "my-repo", - ResourceRef: &v1beta1.PipelineResourceRef{ - Name: "git", - }, - }, - }, - }, - Outputs: []v1beta1.TaskResourceBinding{ - { - PipelineResourceBinding: v1beta1.PipelineResourceBinding{ - Name: "my-image", - ResourceRef: &v1beta1.PipelineResourceRef{ - Name: "image", - }, - }, - }, - }, - }, }, Status: v1beta1.TaskRunStatus{ Status: duckv1.Status{ @@ -240,18 +176,6 @@ func Test_ClusterTaskDescribe(t *testing.T) { }, }, }, - Resources: &v1beta1.TaskRunResources{ - Inputs: []v1beta1.TaskResourceBinding{ - { - PipelineResourceBinding: v1beta1.PipelineResourceBinding{ - Name: "my-repo", - ResourceRef: &v1beta1.PipelineResourceRef{ - Name: "git", - }, - }, - }, - }, - }, }, Status: v1beta1.TaskRunStatus{ Status: duckv1.Status{ @@ -298,28 +222,6 @@ func Test_ClusterTaskDescribe(t *testing.T) { }, }, }, - Resources: &v1beta1.TaskRunResources{ - Inputs: []v1beta1.TaskResourceBinding{ - { - PipelineResourceBinding: v1beta1.PipelineResourceBinding{ - Name: "my-repo", - ResourceRef: &v1beta1.PipelineResourceRef{ - Name: "git", - }, - }, - }, - }, - Outputs: []v1beta1.TaskResourceBinding{ - { - PipelineResourceBinding: v1beta1.PipelineResourceBinding{ - Name: "my-image", - ResourceRef: &v1beta1.PipelineResourceRef{ - Name: "image", - }, - }, - }, - }, - }, }, Status: v1beta1.TaskRunStatus{ Status: duckv1.Status{ diff --git a/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_clustertask_missing_param_default_one_of_everything.golden b/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_clustertask_missing_param_default_one_of_everything.golden index ea23dcd2b7..f8a96e3ee4 100644 --- a/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_clustertask_missing_param_default_one_of_everything.golden +++ b/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_clustertask_missing_param_default_one_of_everything.golden @@ -2,16 +2,6 @@ Command "describe" is deprecated, ClusterTasks are deprecated, this command will Name: clustertask-one-everything Description: a test description -Input Resources - - NAME TYPE - my-repo git - -Output Resources - - NAME TYPE - code-image image - Params NAME TYPE DESCRIPTION DEFAULT VALUE diff --git a/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_full_clustertask_multiple_taskruns.golden b/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_full_clustertask_multiple_taskruns.golden index 92d4e32967..2483f83c91 100644 --- a/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_full_clustertask_multiple_taskruns.golden +++ b/pkg/cmd/clustertask/testdata/Test_ClusterTaskDescribe-Describe_full_clustertask_multiple_taskruns.golden @@ -1,17 +1,6 @@ Command "describe" is deprecated, ClusterTasks are deprecated, this command will be removed in future releases. Name: clustertask-full -Input Resources - - NAME TYPE - my-repo git - my-image image - -Output Resources - - NAME TYPE - code-image image - Params NAME TYPE DESCRIPTION DEFAULT VALUE