diff --git a/docs/pipeline-api.md b/docs/pipeline-api.md index 41fa555253c..6ecdeb7f1ea 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -533,6 +533,19 @@ PipelineSpec + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the pipeline that may be +used to populate a UI.

+
description
string @@ -895,6 +908,19 @@ value.

+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the task that may be +used to populate a UI.

+
description
string @@ -2492,6 +2518,19 @@ TaskRunStatus
+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the pipeline that may be +used to populate a UI.

+
description
string @@ -2608,6 +2647,32 @@ the execution order of tasks relative to one another.

+displayName
+ +string + +
+(Optional) +

DisplayName is the display name of this task within the context of a Pipeline. +This display name may be used to populate a UI.

+
+description
+ +string + +
+(Optional) +

Description is the description of this task within the context of a Pipeline. +This description may be used to populate a UI.

+
taskRef
@@ -5310,6 +5375,19 @@ value.

+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the task that may be +used to populate a UI.

+
description
string @@ -6934,6 +7012,19 @@ value.

+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the task that may be +used to populate a UI.

+
description
string @@ -7292,6 +7383,19 @@ PipelineSpec + + + + + + + + + + + + + + + + + + + + + + + +
+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the pipeline that may be +used to populate a UI.

+
description
string @@ -7681,6 +7785,19 @@ value.

+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the task that may be +used to populate a UI.

+
description
string @@ -9699,6 +9816,19 @@ TaskRunStatus
+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the pipeline that may be +used to populate a UI.

+
description
string @@ -9815,6 +9945,32 @@ the execution order of tasks relative to one another.

+displayName
+ +string + +
+(Optional) +

DisplayName is the display name of this task within the context of a Pipeline. +This display name may be used to populate a UI.

+
+description
+ +string + +
+(Optional) +

Description is the description of this task within the context of a Pipeline. +This description may be used to populate a UI.

+
taskRef
@@ -12746,6 +12902,19 @@ value.

+displayName
+ +string + +
+(Optional) +

DisplayName is a user-facing name of the task that may be +used to populate a UI.

+
description
string diff --git a/docs/pipelines.md b/docs/pipelines.md index 0571e4a034c..c45b4ef9409 100644 --- a/docs/pipelines.md +++ b/docs/pipelines.md @@ -94,6 +94,8 @@ A `Pipeline` definition supports the following fields: - [`workspaces`](#specifying-workspaces) - Specifies a set of Workspaces that the `Pipeline` requires. - [`tasks`](#adding-tasks-to-the-pipeline): - [`name`](#adding-tasks-to-the-pipeline) - the name of this `Task` within the context of this `Pipeline`. + - [`displayName`](#adding-tasks-to-the-pipeline) - a user-facing name of this `Task` within the context of this `Pipeline`. + - [`description`](#adding-tasks-to-the-pipeline) - a description of this `Task` within the context of this `Pipeline`. - [`taskRef`](#adding-tasks-to-the-pipeline) - a reference to a `Task` definition. - [`taskSpec`](#adding-tasks-to-the-pipeline) - a specification of a `Task`. - [`resources`](#specifying-resources-in-pipelinetasks) - Specifies the [`PipelineResource`](resources.md) that @@ -113,10 +115,13 @@ A `Pipeline` definition supports the following fields: multiple `TaskRuns` or `Runs`. - [`results`](#emitting-results-from-a-pipeline) - Specifies the location to which the `Pipeline` emits its execution results. + - [`displayName`](#specifying-a-display-name) - is a user-facing name of the pipeline that may be used to populate a UI. - [`description`](#adding-a-description) - Holds an informative description of the `Pipeline` object. - [`finally`](#adding-finally-to-the-pipeline) - Specifies one or more `Tasks` to be executed in parallel after all other tasks have completed. - [`name`](#adding-finally-to-the-pipeline) - the name of this `Task` within the context of this `Pipeline`. + - [`displayName`](#adding-finally-to-the-pipeline) - a user-facing name of this `Task` within the context of this `Pipeline`. + - [`description`](#adding-finally-to-the-pipeline) - a description of this `Task` within the context of this `Pipeline`. - [`taskRef`](#adding-finally-to-the-pipeline) - a reference to a `Task` definition. - [`taskSpec`](#adding-finally-to-the-pipeline) - a specification of a `Task`. - [`retries`](#using-the-retries-field) - Specifies the number of times to retry the execution of a `Task` after @@ -1169,6 +1174,19 @@ In particular: > Consider using replacement features instead. Read more in [documentation](migrating-v1alpha1-to-v1beta1.md#replacing-pipelineresources-with-tasks) > and [TEP-0074](https://github.com/tektoncd/community/blob/main/teps/0074-deprecate-pipelineresources.md). +## Specifying a display name + +The `displayName` field is an optional field that allows you to add a user-facing name of the `Pipeline` that can be used to populate a UI. For example: + +```yaml +spec: + displayName: "Code Scan" + tasks: + - name: scan + taskRef: + name: sonar-scan +``` + ## Adding a description The `description` field is an optional field and can be used to provide description of the `Pipeline`. diff --git a/docs/tasks.md b/docs/tasks.md index 16f5a732a0b..58347e7020a 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -28,6 +28,7 @@ weight: 201 - [Specifying `Volumes`](#specifying-volumes) - [Specifying a `Step` template](#specifying-a-step-template) - [Specifying `Sidecars`](#specifying-sidecars) + - [Specifying a `DisplayName`](#specifying-a-display-name) - [Adding a description](#adding-a-description) - [Using variable substitution](#using-variable-substitution) - [Substituting parameters and resources](#substituting-parameters-and-resources) @@ -1072,6 +1073,10 @@ was executing before receiving a "stop" signal, the `Sidecar` keeps running, eventually causing the `TaskRun` to time out with an error. For more information, see [issue 1347](https://github.com/tektoncd/pipeline/issues/1347). +### Specifying a display name + +The `displayName` field is an optional field that allows you to add a user-facing name to the task that may be used to populate a UI. + ### Adding a description The `description` field is an optional field that allows you to add an informative description to the `Task`. diff --git a/examples/v1/pipelineruns/pipeline-with-displayname.yaml b/examples/v1/pipelineruns/pipeline-with-displayname.yaml new file mode 100644 index 00000000000..f77d701bf6b --- /dev/null +++ b/examples/v1/pipelineruns/pipeline-with-displayname.yaml @@ -0,0 +1,94 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: sum +spec: + displayName: Sum the two provided integers + params: + - name: a + type: string + default: "1" + description: The first integer + - name: b + type: string + default: "1" + description: The second integer + results: + - name: sum + description: The sum of the two provided integers + steps: + - name: sum + image: bash:latest + script: | + #!/usr/bin/env bash + echo -n $(( "$(params.a)" + "$(params.b)" )) | tee $(results.sum.path) +--- +apiVersion: tekton.dev/v1 +kind: Pipeline +metadata: + name: sum-pipeline +spec: + displayName: Sum Multiple Numbers + description: Calculate the sum of multiple numbers + params: + - name: a + type: string + default: "1" + - name: b + type: string + default: "1" + - name: c + type: string + default: "1" + tasks: + - name: sum-two-numbers + displayName: Calculate the first two numbers + description: Calculate the sum of the first two numbers + taskRef: + name: sum + params: + - name: a + value: "$(params.a)" + - name: b + value: "$(params.b)" + - name: sum-with-third-number + displayName: Sum with the third number + description: Calculate the sum of the first two numbers and the third number + taskRef: + name: sum + params: + - name: a + value: "$(tasks.sum-two-numbers.results.sum)" + - name: b + value: "$(params.c)" + finally: + - name: print-result + displayName: Print the result + description: Print the final result + params: + - name: sum + value: "$(tasks.sum-with-third-number.results.sum)" + taskSpec: + params: + - name: sum + type: string + steps: + - name: print + image: alpine + script: | + echo "$(params.sum)" +--- +apiVersion: tekton.dev/v1 +kind: PipelineRun +metadata: + name: sum +spec: + params: + - name: a + value: "1" + - name: b + value: "2" + - name: c + value: "3" + pipelineRef: + name: sum-pipeline diff --git a/examples/v1beta1/pipelineruns/pipeline-with-displayname.yaml b/examples/v1beta1/pipelineruns/pipeline-with-displayname.yaml new file mode 100644 index 00000000000..1cbdac0852b --- /dev/null +++ b/examples/v1beta1/pipelineruns/pipeline-with-displayname.yaml @@ -0,0 +1,94 @@ +apiVersion: tekton.dev/v1beta1 +kind: Task +metadata: + name: sum +spec: + displayName: Sum the two provided integers + params: + - name: a + type: string + default: "1" + description: The first integer + - name: b + type: string + default: "1" + description: The second integer + results: + - name: sum + description: The sum of the two provided integers + steps: + - name: sum + image: bash:latest + script: | + #!/usr/bin/env bash + echo -n $(( "$(params.a)" + "$(params.b)" )) | tee $(results.sum.path) +--- +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +metadata: + name: sum-pipeline +spec: + displayName: Sum Multiple Numbers + description: Calculate the sum of multiple numbers + params: + - name: a + type: string + default: "1" + - name: b + type: string + default: "1" + - name: c + type: string + default: "1" + tasks: + - name: sum-two-numbers + displayName: Calculate the first two numbers + description: Calculate the sum of the first two numbers + taskRef: + name: sum + params: + - name: a + value: "$(params.a)" + - name: b + value: "$(params.b)" + - name: sum-with-third-number + displayName: Sum with the third number + description: Calculate the sum of the first two numbers and the third number + taskRef: + name: sum + params: + - name: a + value: "$(tasks.sum-two-numbers.results.sum)" + - name: b + value: "$(params.c)" + finally: + - name: print-result + displayName: Print the result + description: Print the final result + params: + - name: sum + value: "$(tasks.sum-with-third-number.results.sum)" + taskSpec: + params: + - name: sum + type: string + steps: + - name: print + image: alpine + script: | + echo "$(params.sum)" +--- +apiVersion: tekton.dev/v1beta1 +kind: PipelineRun +metadata: + name: sum +spec: + params: + - name: a + value: "1" + - name: b + value: "2" + - name: c + value: "3" + pipelineRef: + name: sum-pipeline diff --git a/pkg/apis/pipeline/v1/openapi_generated.go b/pkg/apis/pipeline/v1/openapi_generated.go index 62a5fcd92ec..88f1582c1e4 100644 --- a/pkg/apis/pipeline/v1/openapi_generated.go +++ b/pkg/apis/pipeline/v1/openapi_generated.go @@ -534,6 +534,13 @@ func schema_pkg_apis_pipeline_v1_EmbeddedTask(ref common.ReferenceCallback) comm }, }, }, + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is a user-facing name of the task that may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "description": { SchemaProps: spec.SchemaProps{ Description: "Description is a user-facing description of the task that may be used to populate a UI.", @@ -1667,6 +1674,13 @@ func schema_pkg_apis_pipeline_v1_PipelineSpec(ref common.ReferenceCallback) comm Description: "PipelineSpec defines the desired state of Pipeline.", Type: []string{"object"}, Properties: map[string]spec.Schema{ + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is a user-facing name of the pipeline that may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "description": { SchemaProps: spec.SchemaProps{ Description: "Description is a user-facing description of the pipeline that may be used to populate a UI.", @@ -1791,6 +1805,20 @@ func schema_pkg_apis_pipeline_v1_PipelineTask(ref common.ReferenceCallback) comm Format: "", }, }, + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is the display name of this task within the context of a Pipeline. This display name may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description is the description of this task within the context of a Pipeline. This description may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "taskRef": { SchemaProps: spec.SchemaProps{ Description: "TaskRef is a reference to a task definition.", @@ -4067,6 +4095,13 @@ func schema_pkg_apis_pipeline_v1_TaskSpec(ref common.ReferenceCallback) common.O }, }, }, + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is a user-facing name of the task that may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "description": { SchemaProps: spec.SchemaProps{ Description: "Description is a user-facing description of the task that may be used to populate a UI.", diff --git a/pkg/apis/pipeline/v1/pipeline_types.go b/pkg/apis/pipeline/v1/pipeline_types.go index 3fbebee7839..e7244865c6b 100644 --- a/pkg/apis/pipeline/v1/pipeline_types.go +++ b/pkg/apis/pipeline/v1/pipeline_types.go @@ -80,6 +80,10 @@ func (*Pipeline) GetGroupVersionKind() schema.GroupVersionKind { // PipelineSpec defines the desired state of Pipeline. type PipelineSpec struct { + // DisplayName is a user-facing name of the pipeline that may be + // used to populate a UI. + // +optional + DisplayName string `json:"displayName,omitempty"` // Description is a user-facing description of the pipeline that may be // used to populate a UI. // +optional @@ -159,6 +163,16 @@ type PipelineTask struct { // the execution order of tasks relative to one another. Name string `json:"name,omitempty"` + // DisplayName is the display name of this task within the context of a Pipeline. + // This display name may be used to populate a UI. + // +optional + DisplayName string `json:"displayName,omitempty"` + + // Description is the description of this task within the context of a Pipeline. + // This description may be used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + // TaskRef is a reference to a task definition. // +optional TaskRef *TaskRef `json:"taskRef,omitempty"` diff --git a/pkg/apis/pipeline/v1/swagger.json b/pkg/apis/pipeline/v1/swagger.json index a08d40d8846..34ff5f759b2 100644 --- a/pkg/apis/pipeline/v1/swagger.json +++ b/pkg/apis/pipeline/v1/swagger.json @@ -213,6 +213,10 @@ "description": "Description is a user-facing description of the task that may be used to populate a UI.", "type": "string" }, + "displayName": { + "description": "DisplayName is a user-facing name of the task that may be used to populate a UI.", + "type": "string" + }, "kind": { "type": "string" }, @@ -832,6 +836,10 @@ "description": "Description is a user-facing description of the pipeline that may be used to populate a UI.", "type": "string" }, + "displayName": { + "description": "DisplayName is a user-facing name of the pipeline that may be used to populate a UI.", + "type": "string" + }, "finally": { "description": "Finally declares the list of Tasks that execute just before leaving the Pipeline i.e. either after all Tasks are finished executing successfully or after a failure which would result in ending the Pipeline", "type": "array", @@ -883,6 +891,14 @@ "description": "PipelineTask defines a task in a Pipeline, passing inputs from both Params and from the output of previous tasks.", "type": "object", "properties": { + "description": { + "description": "Description is the description of this task within the context of a Pipeline. This description may be used to populate a UI.", + "type": "string" + }, + "displayName": { + "description": "DisplayName is the display name of this task within the context of a Pipeline. This display name may be used to populate a UI.", + "type": "string" + }, "matrix": { "description": "Matrix declares parameters used to fan out this task.", "$ref": "#/definitions/v1.Matrix" @@ -2102,6 +2118,10 @@ "description": "Description is a user-facing description of the task that may be used to populate a UI.", "type": "string" }, + "displayName": { + "description": "DisplayName is a user-facing name of the task that may be used to populate a UI.", + "type": "string" + }, "params": { "description": "Params is a list of input parameters required to run the task. Params must be supplied as inputs in TaskRuns unless they declare a default value.", "type": "array", diff --git a/pkg/apis/pipeline/v1/task_types.go b/pkg/apis/pipeline/v1/task_types.go index 03184ac7f95..9a46de41b85 100644 --- a/pkg/apis/pipeline/v1/task_types.go +++ b/pkg/apis/pipeline/v1/task_types.go @@ -61,6 +61,11 @@ type TaskSpec struct { // +listType=atomic Params ParamSpecs `json:"params,omitempty"` + // DisplayName is a user-facing name of the task that may be + // used to populate a UI. + // +optional + DisplayName string `json:"displayName,omitempty"` + // Description is a user-facing description of the task that may be // used to populate a UI. // +optional diff --git a/pkg/apis/pipeline/v1beta1/openapi_generated.go b/pkg/apis/pipeline/v1beta1/openapi_generated.go index 92bbcf4afd3..1e926fda074 100644 --- a/pkg/apis/pipeline/v1beta1/openapi_generated.go +++ b/pkg/apis/pipeline/v1beta1/openapi_generated.go @@ -943,6 +943,13 @@ func schema_pkg_apis_pipeline_v1beta1_EmbeddedTask(ref common.ReferenceCallback) }, }, }, + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is a user-facing name of the task that may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "description": { SchemaProps: spec.SchemaProps{ Description: "Description is a user-facing description of the task that may be used to populate a UI.", @@ -2191,6 +2198,13 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineSpec(ref common.ReferenceCallback) Description: "PipelineSpec defines the desired state of Pipeline.", Type: []string{"object"}, Properties: map[string]spec.Schema{ + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is a user-facing name of the pipeline that may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "description": { SchemaProps: spec.SchemaProps{ Description: "Description is a user-facing description of the pipeline that may be used to populate a UI.", @@ -2315,6 +2329,20 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineTask(ref common.ReferenceCallback) Format: "", }, }, + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is the display name of this task within the context of a Pipeline. This display name may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, + "description": { + SchemaProps: spec.SchemaProps{ + Description: "Description is the description of this task within the context of a Pipeline. This description may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "taskRef": { SchemaProps: spec.SchemaProps{ Description: "TaskRef is a reference to a task definition.", @@ -4792,6 +4820,13 @@ func schema_pkg_apis_pipeline_v1beta1_TaskSpec(ref common.ReferenceCallback) com }, }, }, + "displayName": { + SchemaProps: spec.SchemaProps{ + Description: "DisplayName is a user-facing name of the task that may be used to populate a UI.", + Type: []string{"string"}, + Format: "", + }, + }, "description": { SchemaProps: spec.SchemaProps{ Description: "Description is a user-facing description of the task that may be used to populate a UI.", diff --git a/pkg/apis/pipeline/v1beta1/pipeline_conversion.go b/pkg/apis/pipeline/v1beta1/pipeline_conversion.go index 5299aa9ccf9..0c66a3bd13c 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_conversion.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_conversion.go @@ -42,6 +42,7 @@ func (p *Pipeline) ConvertTo(ctx context.Context, to apis.Convertible) error { // ConvertTo implements apis.Convertible func (ps *PipelineSpec) ConvertTo(ctx context.Context, sink *v1.PipelineSpec) error { + sink.DisplayName = ps.DisplayName sink.Description = ps.Description sink.Tasks = nil for _, t := range ps.Tasks { @@ -95,6 +96,7 @@ func (p *Pipeline) ConvertFrom(ctx context.Context, from apis.Convertible) error // ConvertFrom implements apis.Convertible func (ps *PipelineSpec) ConvertFrom(ctx context.Context, source *v1.PipelineSpec) error { + ps.DisplayName = source.DisplayName ps.Description = source.Description ps.Tasks = nil for _, t := range source.Tasks { @@ -137,6 +139,8 @@ func (ps *PipelineSpec) ConvertFrom(ctx context.Context, source *v1.PipelineSpec func (pt PipelineTask) convertTo(ctx context.Context, sink *v1.PipelineTask) error { sink.Name = pt.Name + sink.DisplayName = pt.DisplayName + sink.Description = pt.Description if pt.TaskRef != nil { sink.TaskRef = &v1.TaskRef{} pt.TaskRef.convertTo(ctx, sink.TaskRef) @@ -181,6 +185,8 @@ func (pt PipelineTask) convertTo(ctx context.Context, sink *v1.PipelineTask) err func (pt *PipelineTask) convertFrom(ctx context.Context, source v1.PipelineTask) error { pt.Name = source.Name + pt.DisplayName = source.DisplayName + pt.Description = source.Description if source.TaskRef != nil { newTaskRef := TaskRef{} newTaskRef.convertFrom(ctx, *source.TaskRef) diff --git a/pkg/apis/pipeline/v1beta1/pipeline_conversion_test.go b/pkg/apis/pipeline/v1beta1/pipeline_conversion_test.go index 0fb96de35d3..26252c44a07 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_conversion_test.go @@ -54,6 +54,7 @@ func TestPipelineConversion(t *testing.T) { Namespace: "bar", }, Spec: v1beta1.PipelineSpec{ + DisplayName: "pipeline-display-name", Description: "test", Tasks: []v1beta1.PipelineTask{{ Name: "foo", @@ -74,12 +75,15 @@ func TestPipelineConversion(t *testing.T) { Namespace: "bar", }, Spec: v1beta1.PipelineSpec{ + DisplayName: "pipeline-display-name", Description: "test", Tasks: []v1beta1.PipelineTask{{ Name: "task-1", }, { - Name: "foo", - TaskRef: &v1beta1.TaskRef{Name: "example.com/my-foo-task"}, + Name: "foo", + DisplayName: "task-display-name", + Description: "task-description", + TaskRef: &v1beta1.TaskRef{Name: "example.com/my-foo-task"}, TaskSpec: &v1beta1.EmbeddedTask{ TaskSpec: v1beta1.TaskSpec{ Steps: []v1beta1.Step{{ @@ -149,8 +153,10 @@ func TestPipelineConversion(t *testing.T) { Value: *v1beta1.NewStructuredValues("foo.bar"), }}, Finally: []v1beta1.PipelineTask{{ - Name: "final-task", - TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, + Name: "final-task", + DisplayName: "final-task-display-name", + Description: "final-task-description", + TaskRef: &v1beta1.TaskRef{Name: "foo-task"}, }}, }, }, diff --git a/pkg/apis/pipeline/v1beta1/pipeline_types.go b/pkg/apis/pipeline/v1beta1/pipeline_types.go index 2ea11155148..3651fbf95ba 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_types.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_types.go @@ -86,6 +86,10 @@ func (*Pipeline) GetGroupVersionKind() schema.GroupVersionKind { // PipelineSpec defines the desired state of Pipeline. type PipelineSpec struct { + // DisplayName is a user-facing name of the pipeline that may be + // used to populate a UI. + // +optional + DisplayName string `json:"displayName,omitempty"` // Description is a user-facing description of the pipeline that may be // used to populate a UI. // +optional @@ -165,6 +169,16 @@ type PipelineTask struct { // the execution order of tasks relative to one another. Name string `json:"name,omitempty"` + // DisplayName is the display name of this task within the context of a Pipeline. + // This display name may be used to populate a UI. + // +optional + DisplayName string `json:"displayName,omitempty"` + + // Description is the description of this task within the context of a Pipeline. + // This description may be used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + // TaskRef is a reference to a task definition. // +optional TaskRef *TaskRef `json:"taskRef,omitempty"` diff --git a/pkg/apis/pipeline/v1beta1/swagger.json b/pkg/apis/pipeline/v1beta1/swagger.json index e8171739b5e..f2f3c9593e5 100644 --- a/pkg/apis/pipeline/v1beta1/swagger.json +++ b/pkg/apis/pipeline/v1beta1/swagger.json @@ -433,6 +433,10 @@ "description": "Description is a user-facing description of the task that may be used to populate a UI.", "type": "string" }, + "displayName": { + "description": "DisplayName is a user-facing name of the task that may be used to populate a UI.", + "type": "string" + }, "kind": { "type": "string" }, @@ -1116,6 +1120,10 @@ "description": "Description is a user-facing description of the pipeline that may be used to populate a UI.", "type": "string" }, + "displayName": { + "description": "DisplayName is a user-facing name of the pipeline that may be used to populate a UI.", + "type": "string" + }, "finally": { "description": "Finally declares the list of Tasks that execute just before leaving the Pipeline i.e. either after all Tasks are finished executing successfully or after a failure which would result in ending the Pipeline", "type": "array", @@ -1167,6 +1175,14 @@ "description": "PipelineTask defines a task in a Pipeline, passing inputs from both Params and from the output of previous tasks.", "type": "object", "properties": { + "description": { + "description": "Description is the description of this task within the context of a Pipeline. This description may be used to populate a UI.", + "type": "string" + }, + "displayName": { + "description": "DisplayName is the display name of this task within the context of a Pipeline. This display name may be used to populate a UI.", + "type": "string" + }, "matrix": { "description": "Matrix declares parameters used to fan out this task.", "$ref": "#/definitions/v1beta1.Matrix" @@ -2642,6 +2658,10 @@ "description": "Description is a user-facing description of the task that may be used to populate a UI.", "type": "string" }, + "displayName": { + "description": "DisplayName is a user-facing name of the task that may be used to populate a UI.", + "type": "string" + }, "params": { "description": "Params is a list of input parameters required to run the task. Params must be supplied as inputs in TaskRuns unless they declare a default value.", "type": "array", diff --git a/pkg/apis/pipeline/v1beta1/task_conversion.go b/pkg/apis/pipeline/v1beta1/task_conversion.go index 3fefd5cbfda..19bbec3fdec 100644 --- a/pkg/apis/pipeline/v1beta1/task_conversion.go +++ b/pkg/apis/pipeline/v1beta1/task_conversion.go @@ -78,6 +78,7 @@ func (ts *TaskSpec) ConvertTo(ctx context.Context, sink *v1.TaskSpec) error { p.convertTo(ctx, &new) sink.Params = append(sink.Params, new) } + sink.DisplayName = ts.DisplayName sink.Description = ts.Description return nil } @@ -134,6 +135,7 @@ func (ts *TaskSpec) ConvertFrom(ctx context.Context, source *v1.TaskSpec) error new.convertFrom(ctx, p) ts.Params = append(ts.Params, new) } + ts.DisplayName = source.DisplayName ts.Description = source.Description return nil } diff --git a/pkg/apis/pipeline/v1beta1/task_conversion_test.go b/pkg/apis/pipeline/v1beta1/task_conversion_test.go index 36e25bd6bcb..8913e4e105c 100644 --- a/pkg/apis/pipeline/v1beta1/task_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/task_conversion_test.go @@ -55,6 +55,7 @@ func TestTaskConversion(t *testing.T) { Generation: 1, }, Spec: v1beta1.TaskSpec{ + DisplayName: "task-display-name", Description: "test", Steps: []v1beta1.Step{{ Image: "foo", @@ -76,6 +77,7 @@ func TestTaskConversion(t *testing.T) { Generation: 1, }, Spec: v1beta1.TaskSpec{ + DisplayName: "task-display-name", Description: "test", Steps: []v1beta1.Step{{ Name: "step", diff --git a/pkg/apis/pipeline/v1beta1/task_types.go b/pkg/apis/pipeline/v1beta1/task_types.go index 5d901c902cb..19e14f49252 100644 --- a/pkg/apis/pipeline/v1beta1/task_types.go +++ b/pkg/apis/pipeline/v1beta1/task_types.go @@ -88,6 +88,11 @@ type TaskSpec struct { // +listType=atomic Params ParamSpecs `json:"params,omitempty"` + // DisplayName is a user-facing name of the task that may be + // used to populate a UI. + // +optional + DisplayName string `json:"displayName,omitempty"` + // Description is a user-facing description of the task that may be // used to populate a UI. // +optional