Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show param default value in task describe #443

Merged
merged 2 commits into from
Nov 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pkg/cmd/task/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,17 @@ No params
{{- if eq (len .Task.Spec.Inputs.Params) 0 }}
No params
{{- else }}
NAME TYPE
NAME TYPE DEFAULT_VALUE
piyush-garg marked this conversation as resolved.
Show resolved Hide resolved
{{- range $p := .Task.Spec.Inputs.Params }}
{{ $p.Name }} {{ $p.Type }}
{{- if not $p.Default }}
{{ $p.Name }} {{ $p.Type }} {{ "" }}
{{- else }}
{{- if eq $p.Type "string" }}
{{ $p.Name }} {{ $p.Type }} {{ $p.Default.StringVal }}
{{- else }}
{{ $p.Name }} {{ $p.Type }} {{ $p.Default.ArrayVal }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
20 changes: 13 additions & 7 deletions pkg/cmd/task/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ func TestTaskDescribe_OnlyNameParams(t *testing.T) {
tb.TaskInputs(
tb.InputsParamSpec("myarg", v1alpha1.ParamTypeString),
tb.InputsParamSpec("myprint", v1alpha1.ParamTypeString),
tb.InputsParamSpec("myarray", v1alpha1.ParamTypeArray),
),
),
),
Expand Down Expand Up @@ -208,9 +209,10 @@ Output Resources
No output resources

Params
NAME TYPE
myarg string
myprint string
NAME TYPE DEFAULT_VALUE
myarg string
myprint string
myarray array

Steps
No steps
Expand All @@ -232,7 +234,9 @@ func TestTaskDescribe_Full(t *testing.T) {
tb.InputsResource("my-image", v1alpha1.PipelineResourceTypeImage),
tb.InputsResource("source-repo", v1alpha1.PipelineResourceTypeGit),
tb.InputsParamSpec("myarg", v1alpha1.ParamTypeString),
tb.InputsParamSpec("print", v1alpha1.ParamTypeString),
tb.InputsParamSpec("myarray", v1alpha1.ParamTypeArray),
tb.InputsParamSpec("print", v1alpha1.ParamTypeString, tb.ParamSpecDefault("somethingdifferent")),
tb.InputsParamSpec("output", v1alpha1.ParamTypeArray, tb.ParamSpecDefault("booms", "booms", "booms")),
),
tb.TaskOutputs(
tb.OutputsResource("code-image", v1alpha1.PipelineResourceTypeImage),
Expand Down Expand Up @@ -300,9 +304,11 @@ artifact-image image
code-image image

Params
NAME TYPE
myarg string
print string
NAME TYPE DEFAULT_VALUE
myarg string
myarray array
print string somethingdifferent
output array [booms booms booms]

Steps
NAME
Expand Down