From 27528c04224110e748dd116139da0886598d6977 Mon Sep 17 00:00:00 2001 From: Piyush Garg Date: Mon, 24 Feb 2020 11:06:41 +0530 Subject: [PATCH] Add description field to spec This will add a description field to the spec of pipeline, task pipeline resource ond condition so that it can be used to provide the description of these and can also be used by UI to show description Fix #993 --- pkg/apis/pipeline/v1alpha1/condition_types.go | 5 +++++ pkg/apis/pipeline/v1alpha1/pipeline_types.go | 4 ++++ pkg/apis/pipeline/v1alpha2/pipeline_types.go | 4 ++++ pkg/apis/pipeline/v1alpha2/task_types.go | 5 +++++ pkg/apis/resource/v1alpha1/pipeline_resource_types.go | 8 ++++++-- 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/pkg/apis/pipeline/v1alpha1/condition_types.go b/pkg/apis/pipeline/v1alpha1/condition_types.go index 21c34f73198..ae60bb0bf79 100644 --- a/pkg/apis/pipeline/v1alpha1/condition_types.go +++ b/pkg/apis/pipeline/v1alpha1/condition_types.go @@ -52,6 +52,11 @@ type ConditionSpec struct { // Check declares container whose exit code determines where a condition is true or false Check Step `json:"check,omitempty"` + // Description is a user-facing description of the condition that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + // Params is an optional set of parameters which must be supplied by the user when a Condition // is evaluated // +optional diff --git a/pkg/apis/pipeline/v1alpha1/pipeline_types.go b/pkg/apis/pipeline/v1alpha1/pipeline_types.go index 03b6888f4a3..7f1d9829883 100644 --- a/pkg/apis/pipeline/v1alpha1/pipeline_types.go +++ b/pkg/apis/pipeline/v1alpha1/pipeline_types.go @@ -24,6 +24,10 @@ import ( // PipelineSpec defines the desired state of Pipeline. type PipelineSpec struct { + // Description is a user-facing description of the pipeline that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` // Resources declares the names and types of the resources given to the // Pipeline's tasks as inputs and outputs. Resources []PipelineDeclaredResource `json:"resources,omitempty"` diff --git a/pkg/apis/pipeline/v1alpha2/pipeline_types.go b/pkg/apis/pipeline/v1alpha2/pipeline_types.go index f8acff074fe..36817155cea 100644 --- a/pkg/apis/pipeline/v1alpha2/pipeline_types.go +++ b/pkg/apis/pipeline/v1alpha2/pipeline_types.go @@ -52,6 +52,10 @@ func (p *Pipeline) Copy() PipelineInterface { // PipelineSpec defines the desired state of Pipeline. type PipelineSpec struct { + // Description is a user-facing description of the pipeline that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` // Resources declares the names and types of the resources given to the // Pipeline's tasks as inputs and outputs. Resources []PipelineDeclaredResource `json:"resources,omitempty"` diff --git a/pkg/apis/pipeline/v1alpha2/task_types.go b/pkg/apis/pipeline/v1alpha2/task_types.go index 0d1cd3cfe2c..aae534649e9 100644 --- a/pkg/apis/pipeline/v1alpha2/task_types.go +++ b/pkg/apis/pipeline/v1alpha2/task_types.go @@ -55,6 +55,11 @@ func (t *Task) Copy() TaskInterface { // TaskSpec defines the desired state of Task. type TaskSpec struct { + // Description is a user-facing description of the task that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + // Resources is a list input and output resource to run the task // Resources are represented in TaskRuns as bindings to instances of // PipelineResources. diff --git a/pkg/apis/resource/v1alpha1/pipeline_resource_types.go b/pkg/apis/resource/v1alpha1/pipeline_resource_types.go index 5248f3ce0c4..8b1c309cfa4 100644 --- a/pkg/apis/resource/v1alpha1/pipeline_resource_types.go +++ b/pkg/apis/resource/v1alpha1/pipeline_resource_types.go @@ -93,8 +93,12 @@ type PipelineResourceStatus struct { // PipelineResourceSpec defines an individual resources used in the pipeline. type PipelineResourceSpec struct { - Type PipelineResourceType `json:"type"` - Params []ResourceParam `json:"params"` + Type PipelineResourceType `json:"type"` + // Description is a user-facing description of the pipeline resource that may be + // used to populate a UI. + // +optional + Description string `json:"description,omitempty"` + Params []ResourceParam `json:"params"` // Secrets to fetch to populate some of resource fields // +optional SecretParams []SecretParam `json:"secrets,omitempty"`