You need to enable JavaScript to run this app.
Code Pipeline

Code Pipeline

Copy page
Download PDF
YAML syntax
Pipeline task tasks
Copy page
Download PDF
Pipeline task tasks
A task is an independent execution unit in a pipeline. Tasks within the same stage run in parallel by default, but can be configured for serial execution by setting task dependencies with dependsOn.​
Application scenarios​
A task can consist of multiple Step (steps) or consist of a single Addon (component).​
  • Step combination: Suitable for executing strongly associated actions sequentially. For example, a build task can be divided into steps such as installing dependencies, running tests, and compiling code, with all steps sharing the same workspace environment.​
  • Single Addon: Suitable for invoking standardized, self-contained, and independent capabilities. For example, in scenarios such as manual approval checkpoints or Kubernetes image upgrades, the addon encapsulates the underlying complex logic, and you only need to provide the required input parameters to use it directly.​
Basic configuration parameters​
​
Parameter​
Required​
Description​
tasks.task​
Yes​
Task ID. ID must meet the following requirements:​
  • Only lowercase letters (a-z), digits (0-9), and hyphens (-) are allowed.​
  • Must start with a lowercase letter or digit.​
  • Must end with a lowercase letter or digit.​
  • Length must be 1–40 characters.​
tasks.displayName​
No​
Task display name, shown in the pipeline Console interface. The displayName length must be 1–50 characters.​
tasks.timeout​
Yes​
Default is 2h. The timeout time for task execution. Supports m (minutes), h (hours), and d (days) units. The maximum is 3 days.​
tasks.retries​
No​
Number of task retries, value range is 1–5. If not specified, no retry will be performed.​
tasks.resourcesPolicy​
No​
Whether to download the code source. The following values are supported:​
  • all: Download the code source. Currently, only a single code source is supported.​
  • none: Do not download the code source.​
tasks.steps​
No​
List of steps for task execution. If there is no component in the task, steps are required.​
tasks.component​
No​
Specify the target Addon. If there are no steps in the task, component is required.​
tasks.inputs​
No​
Input parameters passed to the Addon. Required when tasks.component exists. Parameters differ among Addons. For detailed parameter description, see Add-on list.​
​
Workspace configuration​
​
Parameter​
Required​
Description​
tasks.workspace​
No​
The workspace ID. The ID must meet the following requirements:​
  • Only lowercase letters (a-z), digits (0-9), and hyphens (-) are allowed.​
  • Must start with a lowercase letter or digit.​
  • Must end with a lowercase letter or digit.​
  • Length must be between 1 and 40 characters.​
tasks.workspace.resources​
No​
Workspace resource reference list.Required when workspace is not specified or resourcesPolicy is set to all.​
tasks.workspace.resources.ref​
No​
Name of the referenced code source, corresponding to sources.name.Required when workspace is not specified or resourcesPolicy is set to all.​
tasks.workspace.resources.directory​
No​
Code download directory, typically use the $(CP_WORKSPACE) variable.Required when workspace is not specified or resourcesPolicy is set to all.​
​
Workspace example​
​
workspace:​
resources:​
- ref: svcConn-demo​
directory: $(CP_WORKSPACE)​
​
Cache configuration​
The cache feature allows files or directories to be persistently stored and reused across multiple pipeline runs, thereby accelerating build speed.​
​
Parameter​
Required​
Description​
tasks.workspace.caches.key​
No​
Cached ID. ID must meet the following requirements:​
  • Only lowercase letters (a-z), digits (0-9), and hyphens (-) are allowed.​
  • Must start with a lowercase letter or digit.​
  • Must end with a lowercase letter or digit.​
  • Length must be 1–40 characters.​
tasks.workspace.caches.path​
No​
Directory path to be cached.​
​
Cache example​
​
workspace:​
caches:​
- cacheKey: m2​
directory: $(CP_WORKSPACE)/.m2​
cachePolicy: pull-push​
​
Resource configuration​
​
Parameter​
Required​
Description​
tasks.resources.limits.cpu​
Yes​
CPU LimitRange (default: 1C).​
tasks.resources.limits.memory​
Yes​
Memory LimitRange (default: 2Gi).​
​
Resource configuration example​
​
resources:​
limits:​
cpu: 1C​
memory: 2Gi​
​
Task dependency configuration​
warning​
dependsOn only supports configuring task dependencies within the same stage. Please avoid circular dependencies during configuration, such as task A depending on B, B depending on C, and C depending on A.​
​
Parameter​
Required​
Description​
tasks.dependsOn​
No​
List of identifiers for dependent tasks. This task is executed only after all preceding dependent tasks succeed.​
​
Dependency example​
​
tasks:​
- task: go-test​
displayName: test​
timeout: 2h​
steps: [...]​
- task: go-compile​
displayName: compile​
dependsOn:​
- go-test​
timeout: 2h​
steps: [...]​
​
Notification add-on configuration​
​
Category​
Parameter​
Required​
Description​
Basic configuration​
tasks.plugins.plugin​
Yes​
The type of add-on. Must be set to webhook.​
​
tasks.plugins.conditions​
​
Yes​
Trigger condition. Supported values are as follows:​
  • TaskStarted: Task started.​
  • TaskSucceeded: Task succeeded.​
  • TaskFailed: Task failed.​
  • TaskCanceled: Task canceled.​
  • TaskWaiting: Task waiting.​
Input parameters​
tasks.plugins.inputs.type​
Yes​
Notification type. Supported values are as follows:​
  • Feishu: Feishu bot.​
  • Common: Standard Webhook.​
​
tasks.plugins.inputs.url​
Yes​
Webhook receiving address.​
​
tasks.plugins.inputs.token​
No​
Authentication token, used for API authentication.​
​
tasks.plugins.inputs.content​
No​
Custom notification content.​
​
tasks.plugins.inputs.optionValues​
No​
Information fields included in the notification. Required when tasks.plugins.inputs.type is Lark. The following values are supported:​
  • BasicInfo: Basic information.​
  • TriggerPerson: Trigger person.​
  • TriggerEvent: Trigger event.​
  • TriggerTime: Trigger time.​
  • TriggerDetail: Trigger details.​
  • PipelineAddress: Pipeline address.​
​
Notification add-on example​
​
plugins:​
- plugin: webhook​
conditions:​
- TaskStarted​
- TaskSucceeded​
inputs:​
content: custom​
optionValues: BasicInfo,TriggerPerson,TriggerEvent,TriggerTime,TriggerDetail,PipelineAddress​
token: token​
type: Lark​
url: https://open.larkoffice.com/open-apis/bot/v2/hook/<your-hook-id>​
​
Last updated: 2026.05.14 09:56:38