---
url: /en/repo/annotations.md
description: >
  Explains the repository metadata feature for storing key-value annotations on
  Tags and Commits, including how to view metadata via the web interface and
  manage it through the API.
---
## What is Metadata?

Metadata is a data storage capability provided by repositories,
supporting key-value annotations for Tags and Commits.

## Storage Format

Stored in `key: value` format, e.g.: Tag `v1.0.0` metadata:

```yaml
key1: value1
key2: value2
# ...
```

## How to View

* **Tag metadata**: Repository → Tag or Release list → Details → Metadata (hidden when no data exists)
* **Commit metadata**: Repository → Commit list → Details → Metadata

> The web interface currently only supports viewing — adding, modifying, and deleting are not available.

## Management

You can add, delete, and query metadata through plugins
in Cloud Native Build pipelines.
See [Metadata Plugin](https://cnb.cool/cnb/plugins/cnbcool/annotations)
for details.

For example, write build info metadata for the current commit on a `push` event:

```yaml title=".cnb.yml"
main:
  push:
    - stages:
        - name: Write metadata
          image: cnbcool/annotations:latest
          settings:
            type: ADD
            data: |
              build-id=$CNB_BUILD_ID
              commit=$CNB_COMMIT_SHORT
```

For non-Tag events such as `push`, metadata is written to the current commit by default;
for `tag_push` and `tag_deploy.*` events, metadata is written to the corresponding tag.
After a successful write, you can view it under "Metadata" on the Commit or Tag detail page.
