配置与 PURL

用最少配置让 Cogna稳定工作,并且让产物可追溯、可复现。

配置与 PURL

Cogna 默认读取仓库根目录下的 cogna.yml

最小配置模板

schemaVersion: ciq-config/v2
profile: go-module
purl: pkg:golang/github.com/your-org/your-lib@1.0.0
source:
  repo: https://github.com/your-org/your-lib
  ref: main
inputs:
  include:
    - "**/*.go"
cache:
  type: local
  local:
    storeDir: .cogna/cache

关键字段怎么理解

  • profile:仓库类型(Go / Rust / Terraform / OpenAPI / policy-bundle)
  • purl:这个包的唯一标识,建议带版本
  • inputs.include:扫描范围,越精确越快
  • cache:决定是否只用本地,或接入 HTTP cache

PURL 实用建议

  • 在 release 分支构建时,带上准确版本号。
  • 不同组件使用不同 purl,避免混淆。
  • 在 CI 与本地保持一致的命名规则。

团队场景配置

如果你要复用远程 cache:

cache:
  type: http
  storeDir: .cogna/cache
  http:
    endpoint: http://cache.internal:8787

相关文档