tencent cloud

Cloud Native Build

Release Notes and Announcements
Release Notes
Cloud Native Build Community Edition Open Beta
Product Introduction
Purchase Guide
Billing Overview
Community Edition Billing Rules
Enterprise Edition Billing Rules
Beginner Instruction
Activate and Use
Community Edition Quick Start
Enterprise Edition Installation and Use Guide
Operation Guide
personal center
Organization Management
Code Repository
Cloud Native Development
Cloud Native Build
Product Management
Task Set
Practical Tutorial
FAQs
Contact Us
Glossary

Cloud Native Build

PDF
Focus Mode
Font Size
Last updated: 2025-08-07 15:47:32
CNB pipeline configuration uses declarative code management method, configured via the .cnb.yml file in the root directory of the code repository.']
1. After entering the target repository, select Code > Events, click Add .cnb.yml to enter the file configuration page.

2. You can edit related content manually.


Typical Scenario Case

The following context uses a pipeline scenario as an example. Based on these scenario elements, write a CI configuration file and check the execution result.

Phenomenon

Typical pipeline usage scenario:
When there is a Pull Request on the master branch, trigger the pipeline to perform lint and test detection. If failed, send a notification.
Analyze this requirement and deconstruct the build process.
1. The listening master branch, such as main.
2. Triggered repository events, such as pull_request.
3. Build process steps to be executed:
lint
test
4. Boundary condition - trigger notification if failed
notify

Writing Pipeline Configuration

1. Layer-1 property is the branch name:
#branch name
main:
2. When a pull_request event occurs under the branch, trigger build:
#branch name
main:
#event name
pull_request:
3. An event can execute multiple pipelines (parallel), and a pipeline has multiple tasks (serial or parallel). Here we simplify the event to have only one pipeline:
#branch name
main:
#event name
pull_request:
# Array type means multiple pipelines
- name: pr-check
stages:
Include two serial tasks: lint and test.
#branch name
main:
#event name
pull_request:
# Array type means multiple pipelines
- name: pr-check
# Multiple tasks under the pipeline
stages:
# Task to execute
- name: lint
script: echo "lint job"
- name: test
script: echo "test job"
4. When a pipeline task fails, a notification needs to be sent. In addition to stages representing the expected tasks to be executed, the pipeline also has failStages representing the tasks to be executed when stages task execution fails. As follows:
#branch name
main:
#event name
pull_request:
# Array type means multiple pipelines
- name: pr-check
# Multiple tasks under the pipeline
stages:
- name: lint
script: echo "lint job"
- name: test
script: echo "test job"
# executed task when stages fail
failStages:
- name: lint
script: echo "notify to some chat group"

Viewing Pipeline Execution Results

On the warehouse page, click Cloud Native Build to view the build list. The latest one is the push event flow triggered just now. The record with a loading flag below corresponds to the native development build.

Click the push event pipeline name to enter and view build details. As shown in the figure below:


Cloud Native Build Grammar

For detailed Cloud Native Build syntax, see the Syntax description.
For more uses of configuration files, see the Configuration Files description.



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback