You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A PipelineTask now can reference a custom task. This causes the PipelineRun reconciler to create a Run instead of a TaskRun.
Pipeline parameters can be passed to the custom task. The custom task's results can be used by other Pipeline tasks and by the Pipeline results.
can implement behavior that doesn't correspond directly to running a workload in a `Pod` on the cluster.
893
+
For example, a custom task might execute some operation outside of the cluster and wait for its execution to complete.
894
+
895
+
A PipelineRun starts a custom task by creating a [`Run`](https://github.com/tektoncd/pipeline/blob/master/docs/runs.md) instead of a `TaskRun`.
896
+
In order for a custom task to execute, there must be a custom task controller running on the cluster
897
+
that is responsible for watching and updating `Run`s which reference their type.
898
+
If no such controller is running, those `Run`s will never complete and Pipelines using them will time out.
899
+
900
+
Custom tasks are an **_experimental alpha feature_** and should be expected to change
901
+
in breaking ways or even be removed.
902
+
903
+
### Specifying the target Custom Task
904
+
905
+
To specify the custom task type you want to execute, the `taskRef` field
906
+
must include the custom task's `apiVersion` and `kind` as shown below:
907
+
908
+
```yaml
909
+
spec:
910
+
tasks:
911
+
- name: run-custom-task
912
+
taskRef:
913
+
apiVersion: example.dev/v1alpha1
914
+
kind: Example
915
+
```
916
+
917
+
This creates a `Run` of a custom task of type `Example` in the `example.dev` API group with the version `v1alpha1`.
918
+
919
+
You can also specify the `name` of a custom task resource object previously defined in the cluster.
920
+
921
+
```yaml
922
+
spec:
923
+
tasks:
924
+
- name: run-custom-task
925
+
taskRef:
926
+
apiVersion: example.dev/v1alpha1
927
+
kind: Example
928
+
name: myexample
929
+
```
930
+
931
+
If the `taskRef` specifies a name, the custom task controller should look up the
932
+
`Example`resource with that name and use that object to configure the execution.
933
+
934
+
If the `taskRef` does not specify a name, the custom task controller might support
935
+
some default behavior for executing unnamed tasks.
936
+
937
+
### Specifying `Parameters`
938
+
939
+
If a custom task supports [`parameters`](tasks.md#parameters), you can use the
940
+
`params` field to specify their values:
941
+
942
+
```yaml
943
+
spec:
944
+
spec:
945
+
tasks:
946
+
- name: run-custom-task
947
+
taskRef:
948
+
apiVersion: example.dev/v1alpha1
949
+
kind: Example
950
+
name: myexample
951
+
params:
952
+
- name: foo
953
+
value: bah
954
+
```
955
+
956
+
### Using `Results`
957
+
958
+
If the custom task produces results, you can reference them in a Pipeline using the normal syntax,
959
+
`$(tasks.<task-name>.results.<result-name>)`.
960
+
961
+
### Limitations
962
+
963
+
Pipelines do not directly support passing the following items to custom tasks:
964
+
* Pipeline Resources
965
+
* Workspaces
966
+
* Service account name
967
+
* Pod templates
968
+
969
+
888
970
## Code examples
889
971
890
972
For a better understanding of `Pipelines`, study [our code examples](https://github.com/tektoncd/pipeline/tree/master/examples).
0 commit comments