Skip to content

Commit daa90a3

Browse files
committed
[Issue 9032] Add support for step display name
A step in a task is currently represented in the UI using a field (name). That is meant to be machine readable, not human readable. A new field displayName is added to Step.
1 parent d97e81a commit daa90a3

21 files changed

+232
-0
lines changed

config/300-crds/300-task.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2985,6 +2985,11 @@ spec:
29852985
items:
29862986
type: string
29872987
x-kubernetes-list-type: atomic
2988+
displayName:
2989+
description: |-
2990+
DisplayName is a user-facing name of the step that may be
2991+
used to populate a UI.
2992+
type: string
29882993
env:
29892994
description: |-
29902995
List of environment variables to set in the container.
@@ -6624,6 +6629,11 @@ spec:
66246629
- type: integer
66256630
- type: string
66266631
x-kubernetes-int-or-string: true
6632+
displayName:
6633+
description: |-
6634+
DisplayName is a user-facing name of the step that may be
6635+
used to populate a UI.
6636+
type: string
66276637
env:
66286638
description: |-
66296639
List of environment variables to set in the Step.

config/300-crds/300-taskrun.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6263,6 +6263,11 @@ spec:
62636263
- type: integer
62646264
- type: string
62656265
x-kubernetes-int-or-string: true
6266+
displayName:
6267+
description: |-
6268+
DisplayName is a user-facing name of the step that may be
6269+
used to populate a UI.
6270+
type: string
62666271
env:
62676272
description: |-
62686273
List of environment variables to set in the Step.

docs/pipeline-api.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4389,6 +4389,19 @@ Each Step in a Task must have a unique name.</p>
43894389
</tr>
43904390
<tr>
43914391
<td>
4392+
<code>displayName</code><br/>
4393+
<em>
4394+
string
4395+
</em>
4396+
</td>
4397+
<td>
4398+
<em>(Optional)</em>
4399+
<p>DisplayName is a user-facing name of the step that may be
4400+
used to populate a UI.</p>
4401+
</td>
4402+
</tr>
4403+
<tr>
4404+
<td>
43924405
<code>image</code><br/>
43934406
<em>
43944407
string
@@ -13516,6 +13529,19 @@ Each Step in a Task must have a unique name.</p>
1351613529
</tr>
1351713530
<tr>
1351813531
<td>
13532+
<code>displayName</code><br/>
13533+
<em>
13534+
string
13535+
</em>
13536+
</td>
13537+
<td>
13538+
<em>(Optional)</em>
13539+
<p>DisplayName is a user-facing name of the step that may be
13540+
used to populate a UI.</p>
13541+
</td>
13542+
</tr>
13543+
<tr>
13544+
<td>
1351913545
<code>image</code><br/>
1352013546
<em>
1352113547
string

docs/stepactions.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ A `StepAction` definition supports the following fields:
5252
- [`workingDir`](#declaring-workingdir)
5353
- [`securityContext`](#declaring-securitycontext)
5454
- [`volumeMounts`](#declaring-volumemounts)
55+
- [`description`](#declaring-description)
5556

5657
[kubernetes-overview]:
5758
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields
@@ -384,6 +385,22 @@ spec:
384385
script: ...
385386
```
386387

388+
### Declaring description
389+
390+
The `description` field is an optional field that allows you to add a user-facing name to the step that may be used to populate a UI.
391+
392+
```yaml
393+
apiVersion: tekton.dev/v1
394+
kind: StepAction
395+
metadata:
396+
name: myStep
397+
spec:
398+
description: my step
399+
params: ...
400+
volumeMounts: ...
401+
image: ...
402+
script: ...
403+
```
387404

388405
### Referencing a StepAction
389406

docs/tasks.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ weight: 201
2020
- [Breakpoint on failure with `onError`](#breakpoint-on-failure-with-onerror)
2121
- [Redirecting step output streams with `stdoutConfig` and `stderrConfig`](#redirecting-step-output-streams-with-stdoutconfig-and-stderrconfig)
2222
- [Guarding `Step` execution using `when` expressions](#guarding-step-execution-using-when-expressions)
23+
- [Specifying `DisplayName`](#specifying-displayname)
2324
- [Specifying `Parameters`](#specifying-parameters)
2425
- [Specifying `Workspaces`](#specifying-workspaces)
2526
- [Emitting `Results`](#emitting-results)
@@ -599,6 +600,22 @@ The StepState for a skipped step looks like something similar to the below:
599600
```
600601
Where `terminated.exitCode` is `0` and `terminationReason` is `Skipped` to indicate the Step exited successfully and was skipped.
601602

603+
#### Specifying `DisplayName`
604+
605+
The `displayName` field is an optional field that allows you to add a user-facing name to the step that may be used to populate a UI.
606+
607+
```yaml
608+
steps:
609+
- name: ignore-failure-and-produce-a-result
610+
displayName: "Ignore failure and produce a result"
611+
onError: continue
612+
image: busybox
613+
script: |
614+
echo -n 123 | tee $(results.result1.path)
615+
exit 1
616+
echo -n 456 | tee $(results.result2.path)
617+
```
618+
602619
### Specifying `Parameters`
603620

604621
You can specify parameters, such as compilation flags or artifact names, that you want to supply to the `Task` at execution time.

examples/v1/pipelineruns/beta/pipelinerun-with-matrix-and-taskrunspecs-param-substitution.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
- name: node-type
2828
steps:
2929
- name: build-and-push
30+
displayName: "Build and push"
3031
image: ubuntu
3132
script: |
3233
echo "building on $(params.node-type)"

examples/v1/pipelineruns/beta/pipelinerun-with-matrix.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ spec:
1111
- name: browser
1212
steps:
1313
- name: echo
14+
displayName: "echo platform and browser"
1415
image: mirror.gcr.io/alpine
1516
script: |
1617
echo "$(params.platform) and $(params.browser)"

examples/v1/pipelineruns/pipeline-with-displayname.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ spec:
1818
description: The sum of the two provided integers
1919
steps:
2020
- name: sum
21+
displayName: Do the sum
2122
image: mirror.gcr.io/bash
2223
script: |
2324
#!/usr/bin/env bash

examples/v1/pipelineruns/pipelinerun-with-pipelinespec-and-taskspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ spec:
1212
app: "example"
1313
steps:
1414
- name: echo
15+
displayName: "echo step"
1516
image: mirror.gcr.io/ubuntu
1617
script: |
1718
#!/usr/bin/env bash

pkg/apis/pipeline/v1/container_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ type Step struct {
2525
// Name of the Step specified as a DNS_LABEL.
2626
// Each Step in a Task must have a unique name.
2727
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
28+
// DisplayName is a user-facing name of the step that may be
29+
// used to populate a UI.
30+
// +optional
31+
DisplayName string `json:"displayName,omitempty"`
2832
// Docker image name.
2933
// More info: https://kubernetes.io/docs/concepts/containers/images
3034
// +optional

0 commit comments

Comments
 (0)