---
url: /en/develops/badge.md
---
Badges are used to display metric data and can distinguish whether metrics meet standards through different colors.

## Cloud Native Build Related Badges

### Badge Access Path

Badges generated during cloud native builds can be accessed via:

* precise: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/git/{sha}/{metrics}`

* latest: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/git/latest/{metrics}`

* branch latest: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/git/latest/{metrics}?branch={branch}`

* Parameter meanings:
  * `group`: The repository's group
  * `repository`: Repository name
  * `sha`: First 8 characters of the CommitId
  * `latest`: When the branch parameter is not specified, fetch the badge for the latest commit on the default branch; when the branch parameter is specified, fetch the badge corresponding to the latest commit hash of the specified branch.
  * `metrics`: Metric name, e.g., `ci/status/push`, which represents: build time triggered by push event during cloud native build
  * `branch`: The branch name, such as `main`, takes effect only when the SHA is set to `latest`. In this case, the badge corresponding to the latest commit hash of the current branch will be fetched.

### 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 build status

![push event](//cnb.share.ralphlauren.cn/svg/badge/push?message=pending%2C%2010s\&color=pending)
![push event](//cnb.share.ralphlauren.cn/svg/badge/push?message=success%2C%2010s\&color=success)
![push event](//cnb.share.ralphlauren.cn/svg/badge/push?message=failure%2C%2010s\&color=failure)

* ci/status/commit.add

Push event build time and build status

![commit.add event](//cnb.share.ralphlauren.cn/svg/badge/commit.add?message=pending%2C%2010s\&color=pending)
![commit.add event](//cnb.share.ralphlauren.cn/svg/badge/commit.add?message=success%2C%2010s\&color=success)
![commit.add event](//cnb.share.ralphlauren.cn/svg/badge/commit.add?message=failure%2C%2010s\&color=failure)

* ci/status/branch.create

Branch create event build time and build status

![branch.create event](//cnb.share.ralphlauren.cn/svg/badge/branch.create?message=pending%2C%2010s\&color=pending)
![branch.create event](//cnb.share.ralphlauren.cn/svg/badge/branch.create?message=success%2C%2010s\&color=success)
![branch.create event](//cnb.share.ralphlauren.cn/svg/badge/branch.create?message=failure%2C%2010s\&color=failure)

* ci/status/pull\_request

Pull request event build time and build status

![pull\_request event](//cnb.share.ralphlauren.cn/svg/badge/pull_request?message=pending%2C%2010s\&color=pending)
![pull\_request event](//cnb.share.ralphlauren.cn/svg/badge/pull_request?message=success%2C%2010s\&color=success)
![pull\_request event](//cnb.share.ralphlauren.cn/svg/badge/pull_request?message=failure%2C%2010s\&color=failure)

* ci/status/pull\_request.update

Pull request update event build time and build status

![pull\_request.update event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.update?message=pending%2C%2010s\&color=pending)
![pull\_request.update event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.update?message=success%2C%2010s\&color=success)
![pull\_request.update event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.update?message=failure%2C%2010s\&color=failure)

* ci/status/pull\_request.target

Pull request target event build time and build status

![pull\_request.target event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.target?message=pending%2C%2010s\&color=pending)
![pull\_request.target event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.target?message=success%2C%2010s\&color=success)
![pull\_request.target event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.target?message=failure%2C%2010s\&color=failure)

* ci/status/pull\_request.merged

Pull request merged event build time and build status

![pull\_request.merged event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.merged?message=pending%2C%2010s\&color=pending)
![pull\_request.merged event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.merged?message=success%2C%2010s\&color=success)
![pull\_request.merged event](//cnb.share.ralphlauren.cn/svg/badge/pull_request.merged?message=failure%2C%2010s\&color=failure)

* ci/status/tag\_push

Tag push event build time and build status

![tag\_push event](//cnb.share.ralphlauren.cn/svg/badge/tag_push?message=pending%2C%2010s\&color=pending)
![tag\_push event](//cnb.share.ralphlauren.cn/svg/badge/tag_push?message=success%2C%2010s\&color=success)
![tag\_push event](//cnb.share.ralphlauren.cn/svg/badge/tag_push?message=failure%2C%2010s\&color=failure)

#### 2. Workspace Preparation

* ci/git-clone-yyds

Workspace size and preparation time: ![git-clone-yyds event](//cnb.share.ralphlauren.cn/svg/badge/git-clone-yyds?message=2.7s%2C%20163.77%20GB\&color=success)

#### 3. Pipeline Configuration

* ci/pipeline-as-code

Cloud native build configuration file: ![pipeline-as-code event](//cnb.share.ralphlauren.cn/svg/badge/pipeline-as-code?message=.cnb.yml\&color=orange)

#### 4. Cloud Native Development

* code/vscode-started

Development environment preparation time: ![vscode-started](//cnb.share.ralphlauren.cn/svg/badge/prepare-dev-env?message=22s\&color=success)

#### 5. Unit Testing

Using the built-in task [testing:coverage](../build/internal-steps/README.md#coverage) can report unit test badge data

* testing/unit/coverage

Total unit test coverage

![coverage](//cnb.share.ralphlauren.cn/svg/badge/coverage?message=18.67%25\&color=l2)
![coverage](//cnb.share.ralphlauren.cn/svg/badge/coverage?message=38.67%25\&color=l3)
![coverage](//cnb.share.ralphlauren.cn/svg/badge/coverage?message=58.67%25\&color=l4)
![coverage](//cnb.share.ralphlauren.cn/svg/badge/coverage?message=78.67%25\&color=l5)

* testing/unit/coverage-pr

Incremental unit test coverage for this pull request

![coverage-pr](//cnb.share.ralphlauren.cn/svg/badge/coverage%20%40pr?message=18.67%25\&color=l2)
![coverage-pr](//cnb.share.ralphlauren.cn/svg/badge/coverage%20%40pr?message=38.67%25\&color=l3)
![coverage-pr](//cnb.share.ralphlauren.cn/svg/badge/coverage%20%40pr?message=58.67%25\&color=l4)
![coverage-pr](//cnb.share.ralphlauren.cn/svg/badge/coverage%20%40pr?message=78.67%25\&color=l5)

#### 6. Security

* security/tca

Tencent cloud code analysis(TCA)：![tca](//cnb.share.ralphlauren.cn/svg/badge/TCA?message=Fatal/Error:%204\&color=error)

#### 7. Crontab Status

* ci/status/crontab

Crontab build duration and build status

![Crontab Event](//cnb.share.ralphlauren.cn/svg/badge/crontab?message=pending%2C%2010s\&color=pending)
![Crontab Event](//cnb.share.ralphlauren.cn/svg/badge/crontab?message=success%2C%2010s\&color=success)
![Crontab Event](//cnb.share.ralphlauren.cn/svg/badge/crontab?message=failure%2C%2010s\&color=failure)

## Repository Related Badges

### Fork Badge

Display repository fork count in badge form: ![fork badge](//cnb.share.ralphlauren.cn/svg/badge/fork?message=18\&color=orange)

Access path: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/fork`

Parameter meanings:

* `group`: Repository organization path
* `repository`: Repository name

### Star Badge

Display repository star count in badge form: ![star badge](//cnb.share.ralphlauren.cn/svg/badge/star?message=20\&color=orange)

Access path: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/star`

Parameter meanings:

* `group`: Repository organization path
* `repository`: Repository name

### Deploy Badge

Display the latest deployment status and version of a repository environment in badge form:

* With successful deployment: ![deploy badge](//cnb.share.ralphlauren.cn/svg/badge/Environment?message=production%3A%20v1.2.3\&color=success)
* Without deployment record: ![deploy badge](//cnb.share.ralphlauren.cn/svg/badge/Environment?message=production\&color=orange)

Access path: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/deploy?name={name}`

Click-through path: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/deploy.link?name={name}`

Parameter meanings:

* `group`: Repository organization path
* `repository`: Repository name
* `name`: 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: ![release badge](//cnb.share.ralphlauren.cn/svg/badge/Latest%20Release?message=v1.2.3\&color=success)
* Without Release: ![release badge](//cnb.share.ralphlauren.cn/svg/badge/Latest%20Release?message=none\&color=orange)

Access path: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/release`

Click-through path: `https://cnb.share.ralphlauren.cn/{group}/{repository}/-/badge/release.link`

Parameter meanings:

* `group`: Repository organization path
* `repository`: Repository name

## Using Badges in Markdown

The following two formats are supported for using badges as images in markdown:

With domain and repository: `![Full path badge](https://cnb.share.ralphlauren.cn/groupname/reponame/-/badge/git/latest/ci/git-clone-yyds)`

Without domain and repository: paths starting with `/-/badge/git` will be recognized as badges: `![Relative path badge](/-/badge/git/latest/ci/git-clone-yyds)`
