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

Code Pipeline

Copy page
Download PDF
Custom pipeline steps
Create custom steps
Copy page
Download PDF
Create custom steps
To meet the personalization needs of different enterprises and fully leverage team creativity, Code Pipeline has introduced the capability for custom steps. This enables team members to package internal tools that they are familiar with and find easy to use as custom steps, thereby improving business delivery efficiency. This article explains how to create custom steps.​
Background information​
A custom step consists of a YAML description file. The YAML file contains basic information about custom steps, step input parameters, step output parameters, the step execution script (script), and the step image (image). When running Custom steps, the pipeline creates a group of Pods based on the current YAML and executes a script task.​
The following is an example of a custom steps YAML file used in this document. You can quickly adapt this template—based on the version used for our team—to create custom steps suitable for your own team.​
​
# Custom step name, required field. Supports English letters (uppercase and lowercase), numbers, and hyphens ('-'); length must be between 2 and 50 characters; duplicate names are not allowed. ​
step: v2-custom-step​
# Custom steps version, required field. The required format is x.y.z, where x, y, and z are all integers in the range [0,100]. ​
version: 1.0.0​
Display name of custom steps (required field). Supports Chinese and English letters (both uppercase and lowercase), numbers, and the hyphen (“-”); length: 2–50 characters. Used as the display name for the step. The name cannot be empty or duplicated. ​
displayName: custom step v2-demo-doc​
# Custom steps description (optional). Up to 200 characters. Supports Chinese and English, including English uppercase and lowercase letters and special characters.​
description: custom step v2-demo-doc​
# Category, required field. Currently, only the following categories are supported: [构建] Build, [测试] Test, [部署] Deploy, [镜像仓库] Registry, [命令执行] Command, and [其他] Other.​
category: Other​
# Runtime image, required field. Supports public images and private images. You must configure the access credentials with the imageCredential parameter for private images.​
image: xxx.cr.volces.com/ns/busybox:latest​
# Credential information for pulling private images; optional. The following uses the Volcano Engine image repository as an example.​
imageCredential:​
# Image repository URL. You only need to enter the host address.​
registry: xxx.cr.volces.com​
# Image repository username.​
username: xxx@1400******​
# Image repository access password; supports permanent and temporary passwords. Caution: Temporary passwords have a validity period. After expiration, you cannot pull private images normally. When the frontend displays the custom steps YAML, passwords are masked.​
password: xxxxxxxxx​
# Run the script​
Required fields cannot be empty. Functions similarly to ENTRYPOINT in a Dockerfile, and is used to specify the container's startup program and parameters.​
# Step input parameters can be set by using export xxx=$(inputs.KEY). Caution: Ensure that the KEY value matches the value of inputs.name; otherwise, you will not be able to successfully reference the Step input parameter.​
# You can inject pipeline preset variables by using export xxx=$(preset variable name).​
script: |​
# Examples of referencing input configuration parameters of custom steps. Obtain the settings command and execute it. Example of referencing configuration parameters in a custom step's input. Retrieve the set command and execute it.​
$(inputs.cmd)​
# Example of referencing input parameters for custom steps Obtain the value of the parameter and output it. Example of referencing configuration parameters in a custom step's input. Retrieve the value of the configuration item and output it.​
export ENV=$(inputs.pipeline-env)​
echo "ENV:$ENV"​
# Examples of referencing pipeline preset variables. Print the pipeline ID. ​
echo "PIPELINE_ID:$(PIPELINE_ID)"​
Examples of referencing predefined variables in a pipeline. Print the pipeline execution time. ​
echo "DATETIME:$(DATETIME)"​
# Define input information for the step (optional). Supports the configuration of input parameters for multiple steps.​
inputs:​
# Field name, required field. Supports uppercase and lowercase English letters, numbers, and hyphens; length must be between 2 and 50 characters; duplicate names are not allowed.​
- name: cmd​
# Field display name, required field. Parameter names can contain uppercase and lowercase Chinese and English letters, numbers, and hyphens ('-'), and must be 2 to 50 characters long. Each name must be unique and cannot be empty.​
displayName: Execute a custom command​
description: Execute a custom command​
# Field type (required field).​
type: string​
# Field default value, optional field.​
defaultValue: echo hello world​
# Whether the field is required, required field. When set to true, a small red asterisk will appear before fields on the step configuration page, and it will validate whether the fields have been filled in when saving.​
required: true​
# Field configuration style.​
uiConfig:​
type: CodeEditor​
- name: pipeline-env​
displayName: Variables​
description: Variables​
type: string​
defaultValue:​
required: true​
uiConfig:​
type: Input​
# Define the output information for the step. Optional.​
# This example does not use outputs.​
# outputs:​
# - name: xxx​
# displayName: xxx​
# type: string​
​
Prerequisites​
Docker images for use by custom steps are ready. It is recommended to upload to the Volcano Engine image repository. For operations related to uploading to the Volcano Engine image repository, refer to Push and pull images.​
Limit​
  • Accounts with CPAdminAccess permission can create custom steps. IAM users can contact the corresponding Volcano Engine root user to be granted this permission. For specific operations, see Configure permissions.​
  • By configuring the image access credentials (imageCredential) in the YAML file, custom steps can use private images. If you have higher requirements for image security, we recommend using the following solutions.​
tip​
Solution introduction:​
  1. Upload the built custom step image to the Volcano Engine private image repository. You can refer to Push and Pull Images for specific operations.​
  1. Install the passwordless image pull component in Volcengine Kubernetes Engine, and set the private image repository to allow passwordless pulls. For specific operations, refer to Install the password-free component.​
  1. Use Volcengine Kubernetes Engine clusters as a private resource pool to run custom pipeline steps. For specific operations, refer to Create a private resource pool.​
Procedure​
  1. Log in to Code Pipeline Console, and in the left navigation pane, select Template Marketplace > Step Template.​
  1. On the step template page, click Create custom steps. The Create custom steps panel appears.​
  1. In the text box on the left, write the step content according to the YAML requirements for custom steps.​
  1. After you finish writing, click confirm.​
  • Custom steps that are successfully created will be displayed under the corresponding category.​
What to do next​
After custom steps are created successfully, team members can use them in the pipeline. For specific operations, refer to Use custom steps.​
​
Last updated: 2025.09.10 17:37:25