Overview
A CustomRun requires a custom task controller to be running on the cluster. This controller watches CustomRuns that reference its task type and updates their status. Without a controller, CustomRuns will have no status and no action will be taken.v1beta1.CustomRun has replaced v1alpha1.Run for executing Custom Tasks. See the migration documentation for details on updating from v1alpha1.Run.Configuring a CustomRun
Required Fields
apiVersion- Currently onlytekton.dev/v1beta1is supportedkind- Must beCustomRunmetadata- Uniquely identifies the CustomRun (e.g.,name)spec- Configuration for the CustomRun- Either
customRefORcustomSpec(not both)
- Either
Optional Fields
timeout- Maximum duration for a single executionretries- Number of retries upon failureparams- Execution parameters for the custom taskserviceAccountName- ServiceAccount for executing the CustomRunworkspaces- Physical volumes for workspace requirements
Specifying the Target Custom Task
You can reference a custom task in two ways:- Using customRef
- Using customSpec
Referencing an Existing Custom Task
UsecustomRef to reference a custom task type by API group and kind:MyCustomKind in the example.dev/v1beta1 API group will execute it.Referencing by Name
You can also specify a named custom task resource:Example resource with that name and use it to configure execution.Unnamed Tasks
If no name is specified, the custom task controller may provide default behavior:Parameters
Pass parameters to custom tasks using theparams field:
Workspaces
If supported by the custom task, provide workspaces to share data:Service Account
Execute with specific credentials by specifying a ServiceAccount:configmap-defaults, or the namespace’s default service account.
Timeout
Specify a maximum duration for the custom task:Timeout support is optional but recommended. The custom task controller must implement timeout behavior. Tekton controllers never directly update CustomRun status.
Timeout Implementation Guide for Controllers
- Tekton controllers never directly update CustomRun status - the custom task controller must handle timeouts
- When
CustomRun.Spec.Statusis set toRunCancelled, the controller MUST cancel the CustomRun for pipeline-level timeout and cancellation to work - Controllers should watch for
CustomRun.Spec.Status == RunCancelledorCustomRun.HasTimedOut()and take cleanup actions - Set
conditionson the CustomRun’s status toSucceeded/Falsewith optional reasonCustomRunTimedOut - Timeout is specified for each retry attempt, not all retries combined
Retries
Specify the number of retry attempts:Retry Implementation Guide for Controllers
- Tekton only checks
ConditionSucceededto determine termination - controllers MUST NOT setConditionSucceededtoFalseuntil all retries are exhausted - Controllers that don’t support retry can simply ignore the field
- Update the
RetriesStatusfield on each retry attempt - Tekton does not validate that
RetriesStatusentries match the retry count
Cancellation
Custom tasks must implement cancellation to support pipeline-level timeouts and cancellation. Pipeline Controller signals cancellation by settingspec.Status and spec.StatusMessage. The CustomRun controller updates status.conditions:
Monitoring Execution Status
The CustomRun’sstatus field tracks execution state, start and completion times, and output results.
Status Conditions
Custom task controllers update thestatus.conditions field to report progress:
Ongoing Execution:
Status Values
| Status | Description |
|---|---|
| (unset) | The custom task controller has not taken any action |
| Unknown | Execution has started and is ongoing |
| True | Completed successfully |
| False | Completed unsuccessfully, all retries exhausted |
Complete Status Example
Results
Custom task controllers can report output values in theresults field after completion:
Complete Examples
Example with Referenced Task
Example resource named my-example-task and uses it to configure execution.