---
url: /zh/paas/plugin-source.md
description: |
  介绍 PAAS 版插件市场的数据源配置方式， 说明插件数据源的 JSON 格式结构及如何在管理端配置多条数据源。
---
在 CNB 中，插件本质上是一个 Docker 镜像。

插件市场是聚合展示插件的入口，供用户查询和选用。

## 数据源

插件数据源是 JSON 格式的数组，每个元素代表一个插件。

管理员在 **管理端 → 后台管理 → 功能配置 → 文档数据源管理** 中按分类配置多条数据源。

以下示例展示了单个插件元素的完整结构，字段含义如下：

```json
[
  {
    "id": "cnbcool/hello-world",
    "name": "hello world",
    "description": "一个简单的插件 demo",
    "tags": ["demo"],
    "readme": "https://raw.example.com/cnb/plugins/cnbcool/hello-world/README.md",
    "logo": "https://raw.example.com/cnb/plugins/cnbcool/hello-world/logo.png",
    "source": "https://cnb.cool/cnb/plugins/cnbcool/hello-world",
    "bugs": "https://cnb.cool/cnb/plugins/cnbcool/hello-world/-/issues",
    "images": "https://hub.docker.com/r/cnbcool/hello-world/tags"
  }
]
```

| 字段          | 说明                                               |
| ------------ | -------------------------------------------------- |
| `id`         | 插件唯一标识，格式通常为 `组织名/插件名`            |
| `name`       | 插件展示名称                                       |
| `description` | 插件简介，展示在插件卡片上                         |
| `tags`       | 插件标签，便于分类检索                             |
| `readme`     | 插件 README 的 raw 地址，用于展示使用说明          |
| `logo`       | 插件 Logo 的 raw 地址                              |
| `source`     | 插件源码仓库地址                                   |
| `bugs`       | 插件 Issue 反馈地址                                |
| `images`     | 插件镜像的可用 Tag 列表地址                        |

## 示例项目

在单个 JSON 文件中手工维护多个插件不便，可参考
[示例项目](https://cnb.cool/examples/ecosystem/plugins-data-source)：
各插件分目录维护，通过流水线自动聚合生成 `plugins.json`。
项目生成的聚合结果示例：

```json
[
  {
    "id": "hello-world",
    "name": "hello world",
    "description": "一个简单的插件demo",
    "tags": ["demo"],
    "readme": "https://cnb.cool/examples/ecosystem/plugins-data-source/-/git/raw/main/plugins/hello-world/README.md",
    "logo": "https://cnb.cool/examples/ecosystem/plugins-data-source/-/git/raw/main/plugins/hello-world/logo.png",
    "source": "https://cnb.cool/cnb/plugins/cnbcool/hello-world",
    "bugs": "https://cnb.cool/cnb/plugins/cnbcool/hello-world/-/issues",
    "images": "https://hub.docker.com/r/cnbcool/hello-world/tags"
  }
]
```
