Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions config/300-crds/300-task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2985,6 +2985,11 @@ spec:
items:
type: string
x-kubernetes-list-type: atomic
displayName:
description: |-
DisplayName is a user-facing name of the step that may be
used to populate a UI.
type: string
env:
description: |-
List of environment variables to set in the container.
Expand Down Expand Up @@ -6624,6 +6629,11 @@ spec:
- type: integer
- type: string
x-kubernetes-int-or-string: true
displayName:
description: |-
DisplayName is a user-facing name of the step that may be
used to populate a UI.
type: string
env:
description: |-
List of environment variables to set in the Step.
Expand Down
5 changes: 5 additions & 0 deletions config/300-crds/300-taskrun.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6277,6 +6277,11 @@ spec:
- type: integer
- type: string
x-kubernetes-int-or-string: true
displayName:
description: |-
DisplayName is a user-facing name of the step that may be
used to populate a UI.
type: string
env:
description: |-
List of environment variables to set in the Step.
Expand Down
26 changes: 26 additions & 0 deletions docs/pipeline-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4389,6 +4389,19 @@ Each Step in a Task must have a unique name.</p>
</tr>
<tr>
<td>
<code>displayName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>DisplayName is a user-facing name of the step that may be
used to populate a UI.</p>
</td>
</tr>
<tr>
<td>
<code>image</code><br/>
<em>
string
Expand Down Expand Up @@ -13516,6 +13529,19 @@ Each Step in a Task must have a unique name.</p>
</tr>
<tr>
<td>
<code>displayName</code><br/>
<em>
string
</em>
</td>
<td>
<em>(Optional)</em>
<p>DisplayName is a user-facing name of the step that may be
used to populate a UI.</p>
</td>
</tr>
<tr>
<td>
<code>image</code><br/>
<em>
string
Expand Down
17 changes: 17 additions & 0 deletions docs/stepactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ A `StepAction` definition supports the following fields:
- [`workingDir`](#declaring-workingdir)
- [`securityContext`](#declaring-securitycontext)
- [`volumeMounts`](#declaring-volumemounts)
- [`description`](#declaring-description)

[kubernetes-overview]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields
Expand Down Expand Up @@ -384,6 +385,22 @@ spec:
script: ...
```

### Declaring description

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.

```yaml
apiVersion: tekton.dev/v1
kind: StepAction
metadata:
name: myStep
spec:
description: my step
params: ...
volumeMounts: ...
image: ...
script: ...
```

### Referencing a StepAction

Expand Down
17 changes: 17 additions & 0 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ weight: 201
- [Breakpoint on failure with `onError`](#breakpoint-on-failure-with-onerror)
- [Redirecting step output streams with `stdoutConfig` and `stderrConfig`](#redirecting-step-output-streams-with-stdoutconfig-and-stderrconfig)
- [Guarding `Step` execution using `when` expressions](#guarding-step-execution-using-when-expressions)
- [Specifying `DisplayName`](#specifying-displayname)
- [Specifying `Parameters`](#specifying-parameters)
- [Specifying `Workspaces`](#specifying-workspaces)
- [Emitting `Results`](#emitting-results)
Expand Down Expand Up @@ -599,6 +600,22 @@ The StepState for a skipped step looks like something similar to the below:
```
Where `terminated.exitCode` is `0` and `terminationReason` is `Skipped` to indicate the Step exited successfully and was skipped.

#### Specifying `DisplayName`

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.

```yaml
steps:
- name: ignore-failure-and-produce-a-result
displayName: "Ignore failure and produce a result"
onError: continue
image: busybox
script: |
echo -n 123 | tee $(results.result1.path)
exit 1
echo -n 456 | tee $(results.result2.path)
```

### Specifying `Parameters`

You can specify parameters, such as compilation flags or artifact names, that you want to supply to the `Task` at execution time.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ spec:
- name: node-type
steps:
- name: build-and-push
displayName: "Build and push"
image: ubuntu
script: |
echo "building on $(params.node-type)"
Expand Down
1 change: 1 addition & 0 deletions examples/v1/pipelineruns/beta/pipelinerun-with-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ spec:
- name: browser
steps:
- name: echo
displayName: "echo platform and browser"
image: mirror.gcr.io/alpine
script: |
echo "$(params.platform) and $(params.browser)"
Expand Down
1 change: 1 addition & 0 deletions examples/v1/pipelineruns/pipeline-with-displayname.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
description: The sum of the two provided integers
steps:
- name: sum
displayName: Do the sum
image: mirror.gcr.io/bash
script: |
#!/usr/bin/env bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
app: "example"
steps:
- name: echo
displayName: "echo step"
image: mirror.gcr.io/ubuntu
script: |
#!/usr/bin/env bash
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/pipeline/v1/container_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ type Step struct {
// Name of the Step specified as a DNS_LABEL.
// Each Step in a Task must have a unique name.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// DisplayName is a user-facing name of the step that may be
// used to populate a UI.
// +optional
DisplayName string `json:"displayName,omitempty"`
// Docker image name.
// More info: https://kubernetes.io/docs/concepts/containers/images
// +optional
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/pipeline/v1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions pkg/apis/pipeline/v1/pipeline_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,19 @@ func TestPipelineTask_ValidateEmbeddedOrType(t *testing.T) {
},
},
},
}, {
name: "just steps with DisplayName",
pt: PipelineTask{
TaskSpec: &EmbeddedTask{
TaskSpec: TaskSpec{
Steps: []Step{{
Name: "foo",
DisplayName: "step DisplayName",
Image: "bar",
}},
},
},
},
}, {
name: "apiVersion and steps",
pt: PipelineTask{
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/pipeline/v1/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,10 @@
"default": {},
"$ref": "#/definitions/v1.ResourceRequirements"
},
"displayName": {
"description": "DisplayName is a user-facing name of the step that may be used to populate a UI.",
"type": "string"
},
"env": {
"description": "List of environment variables to set in the Step. Cannot be updated.",
"type": "array",
Expand Down
35 changes: 35 additions & 0 deletions pkg/apis/pipeline/v1/task_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,28 @@ func TestTaskValidate(t *testing.T) {
})
}
}
func TestTaskValidateStepWithDisplayName(t *testing.T) {
t.Run("valid task with step display name", func(t *testing.T) {
ctx := t.Context()
task := &v1.Task{
ObjectMeta: metav1.ObjectMeta{Name: "task"},
Spec: v1.TaskSpec{
Steps: []v1.Step{{
Name: "my-step",
DisplayName: "My Step",
Image: "my-image",
Script: `
#!/usr/bin/env bash
echo hello`,
}},
},
}
err := task.Validate(ctx)
if err != nil {
t.Errorf("Task.Validate() returned error for valid Task: %v", err)
}
})
}

func TestTaskSpecValidatePropagatedParamsAndWorkspaces(t *testing.T) {
type fields struct {
Expand Down Expand Up @@ -371,6 +393,19 @@ func TestTaskSpecValidate(t *testing.T) {
MountPath: "some/path",
}},
},
}, {
name: "valid step with displayName",
fields: fields{
Steps: []v1.Step{{
Image: "my-image",
DisplayName: "Step with DisplayName",
Args: []string{"arg"},
}},
Results: []v1.TaskResult{{
Name: "MY-RESULT",
Description: "my great result",
}},
},
}, {
name: "valid result",
fields: fields{
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/pipeline/v1beta1/container_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (r *Ref) convertFrom(ctx context.Context, source v1.Ref) {

func (s Step) convertTo(ctx context.Context, sink *v1.Step) {
sink.Name = s.Name
sink.DisplayName = s.DisplayName
sink.Image = s.Image
sink.Command = s.Command
sink.Args = s.Args
Expand Down Expand Up @@ -81,6 +82,7 @@ func (s Step) convertTo(ctx context.Context, sink *v1.Step) {

func (s *Step) convertFrom(ctx context.Context, source v1.Step) {
s.Name = source.Name
s.DisplayName = source.DisplayName
s.Image = source.Image
s.Command = source.Command
s.Args = source.Args
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/pipeline/v1beta1/container_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ type Step struct {
// Name of the Step specified as a DNS_LABEL.
// Each Step in a Task must have a unique name.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// DisplayName is a user-facing name of the step that may be
// used to populate a UI.
// +optional
DisplayName string `json:"displayName,omitempty"`
// Image reference name to run for this Step.
// More info: https://kubernetes.io/docs/concepts/containers/images
// +optional
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/pipeline/v1beta1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions pkg/apis/pipeline/v1beta1/pipeline_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1119,6 +1119,19 @@ func TestPipelineTask_ValidateEmbeddedOrType(t *testing.T) {
},
},
},
}, {
name: "just steps with DisplayName",
pt: PipelineTask{
TaskSpec: &EmbeddedTask{
TaskSpec: TaskSpec{
Steps: []Step{{
Name: "foo",
DisplayName: "step DisplayName",
Image: "bar",
}},
},
},
},
}, {
name: "apiVersion and steps",
pt: PipelineTask{
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/pipeline/v1beta1/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2045,6 +2045,10 @@
},
"x-kubernetes-list-type": "atomic"
},
"displayName": {
"description": "DisplayName is a user-facing name of the step that may be used to populate a UI.",
"type": "string"
},
"env": {
"description": "List of environment variables to set in the container. Cannot be updated.",
"type": "array",
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/pipeline/v1beta1/task_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spec:
description: test
steps:
- image: foo
- displayName: "step-display-name"
params:
- name: param-1
type: string
Expand Down
Loading
Loading