Skip to content

Commit

Permalink
clarify in docs to not use apiVersion for taskRef for non-customtask
Browse files Browse the repository at this point in the history
This commit closes tektoncd#6682. When apiversion and kind are both set for
task, it is also considered to be a custom task. If users want to refer
to tasks or cluster tasks, apiVersion shouldn't be set. This commit
clarify this in the docs.

Signed-off-by: Yongxuan Zhang yongxuanzhang@google.com
Yongxuanzhang authored and tekton-robot committed May 25, 2023
1 parent 897c777 commit a1036ad
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion docs/pipelines.md
Original file line number Diff line number Diff line change
@@ -279,6 +279,8 @@ tasks:
name: build-push
```

**Note:** Using both `apiVersion` and `kind` will create [CustomRun](customruns.md), don't set `apiVersion` if only referring to [`Task`](tasks.md).

or

```yaml
@@ -1537,7 +1539,8 @@ that is responsible for watching and updating `CustomRun`s which reference their
### Specifying the target Custom Task

To specify the custom task type you want to execute, the `taskRef` field
must include the custom task's `apiVersion` and `kind` as shown below:
must include the custom task's `apiVersion` and `kind` as shown below.
Using `apiVersion` will always create a `CustomRun`. If `apiVersion` is set, `kind` is required as well.

```yaml
spec:
7 changes: 3 additions & 4 deletions pkg/reconciler/taskrun/resources/taskref_test.go
Original file line number Diff line number Diff line change
@@ -396,10 +396,9 @@ func TestGetTaskFunc(t *testing.T) {
},
},
ref: &v1beta1.TaskRef{
Name: "simple",
APIVersion: "tekton.dev/v1beta1",
Kind: v1beta1.ClusterTaskKind,
Bundle: u.Host + "/remote-cluster-task",
Name: "simple",
Kind: v1beta1.ClusterTaskKind,
Bundle: u.Host + "/remote-cluster-task",
},
expected: &v1beta1.Task{
ObjectMeta: metav1.ObjectMeta{Name: "simple"},

0 comments on commit a1036ad

Please sign in to comment.