Skip to content

Commit

Permalink
Add missing omitempty that breaks compatibility
Browse files Browse the repository at this point in the history
Adding "omitempty" on the optional "description" field in WorkspacePipelineDeclaration, to be compatible with previous versions.

v1alpha1 is type aliased with v1beta1, but a new optional field is added.

Submitting without "omitempty" will result in an error from the admission webhook: "webhook.tekton.dev" denied the request: mutation failed: cannot decode incoming new object: json: unknown field: "description"

By adding "omitempty" tag, this field is not sent to the server when empty.
  • Loading branch information
jlpettersson authored and tekton-robot committed Mar 27, 2020
1 parent 597f71c commit 0910814
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1beta1/workspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type WorkspacePipelineDeclaration struct {
// used in the Pipeline. It can be useful to include a bit of detail about which
// tasks are intended to have access to the data on the workspace.
// +optional
Description string `json:"description"`
Description string `json:"description,omitempty"`
}

// WorkspacePipelineTaskBinding describes how a workspace passed into the pipeline should be
Expand Down

0 comments on commit 0910814

Please sign in to comment.