Badges
About 960 wordsAbout 3 min
Badges display metric data, using color to indicate whether standards are met.
Cloud Native Build Related Badges
Badge Access Path
Badge access paths for cloud native builds:
precise:
https://cnb.build/{group}/{repository}/-/badge/git/{sha}/{metrics}latest:
https://cnb.build/{group}/{repository}/-/badge/git/latest/{metrics}branch latest:
https://cnb.build/{group}/{repository}/-/badge/git/latest/{metrics}?branch={branch}Parameter meanings:
group: Organization path of the repositoryrepository: Repository namesha: First 8 characters of the CommitIdlatest: When branch is not specified, fetches the badge for the latest default branch commit; when specified, fetches the badge for the latest commit of that branchmetrics: Metric name, e.g.,ci/status/push, representing the build time triggered by push eventsbranch: Branch name, e.g.,main, only effective when sha islatest
Badge Types
During cloud native builds, badge data for relevant build metrics will be automatically uploaded:
1. Git Events
- ci/status/push
Push event build time and status
- ci/status/commit.add
Push event build time and status
- ci/status/branch.create
Branch create event build time and status
- ci/status/pull_request
Pull request event build time and status
- ci/status/pull_request.update
Pull request update event build time and status
- ci/status/pull_request.target
Pull request target event build time and status
- ci/status/pull_request.merged
Pull request merged event build time and status
- ci/status/tag_push
Tag push event build time and status
2. Workspace Preparation
- ci/git-clone-yyds
Workspace size and preparation time:
3. Pipeline Configuration
- ci/pipeline-as-code
Cloud native build configuration file:
4. Cloud Native Development
- code/vscode-started
Development environment preparation time:
5. Unit Testing
Using the built-in task testing:coverage can report unit test badge data
- testing/unit/coverage
Total unit test coverage
- testing/unit/coverage-pr
Incremental unit test coverage for this pull request
6. Security
- security/tca
Tencent cloud code analysis(TCA):
7. Crontab Status
- ci/status/crontab
Crontab build duration and build status
Repository Related Badges
Fork Badge
Display repository fork count in badge form:
Access path: https://cnb.build/{group}/{repository}/-/badge/fork
Parameter meanings:
group: Repository organization pathrepository: Repository name
Star Badge
Display repository star count in badge form:
Access path: https://cnb.build/{group}/{repository}/-/badge/star
Parameter meanings:
group: Repository organization pathrepository: Repository name
Deploy Badge
Display the latest deployment status and version of a repository environment in badge form:
- With successful deployment:
- Without deployment record:
Access path: https://cnb.build/{group}/{repository}/-/badge/deploy?name={name}
Click-through path: https://cnb.build/{group}/{repository}/-/badge/deploy.link?name={name}
Parameter meanings:
group: Repository organization pathrepository: Repository namename: Deployment environment name (required), e.g.,production,staging, etc.
Release Badge
Display the latest Release version of a repository in badge form. If a Release tag has been manually set as the Latest Release, the badge will prioritize displaying that manually set Release; otherwise, it defaults to the most recently created Release:
- With Release:
- Without Release:
Access path: https://cnb.build/{group}/{repository}/-/badge/release
Click-through path: https://cnb.build/{group}/{repository}/-/badge/release.link
Parameter meanings:
group: Repository organization pathrepository: Repository name
Using Badges in Markdown
The following two formats are supported for embedding badges as images in markdown:
With domain and repository: 
Without domain and repository: paths starting with /-/badge/git will be recognized as badges: 