跳转到内容

配置参考

所有流水线行为由 config/ 中的两个 YAML 文件控制。

api:
base_url: "https://example-tenant.console.ves.volterra.io"
tenant: "example-tenant"
namespace: "example-namespace"
timeout: 30
retries: 3
retry_delay: 2
字段描述
base_urlF5 XC 控制台 API 基础 URL。可通过 F5XC_API_URL 环境变量覆盖。
tenant用于 API 路径的租户名称。
namespaceCRUD 操作的默认命名空间。
timeoutHTTP 请求超时时间(秒)。
retries失败时的重试次数。
retry_delay重试之间的间隔秒数。
download:
url: "https://docs.cloud.f5.com/docs-v2/downloads/f5-distributed-cloud-open-api.zip"
output_dir: "specs/original"
etag_cache: ".etag_cache"
字段描述
url官方 F5 XC OpenAPI 规范包(ZIP)的 URL。
output_dir解压后的规范文件存储位置。
etag_cache存储 HTTP ETag 以进行条件下载的文件。

十个类别对应 OpenAPI schema 约束类型。每个类别可以独立启用/禁用。

validation_categories:
string_length:
enabled: true
keywords: ["minLength", "maxLength"]
description: "Validate string length boundaries"
类别关键字
string_lengthminLength, maxLength
patternpattern
numeric_boundsminimum, maximum, exclusiveMinimum, exclusiveMaximum
required_fieldsrequired
enum_valuesenum
array_boundsminItems, maxItems, uniqueItems
object_structureadditionalProperties, properties, propertyNames
compositiononeOf, anyOf, allOf
dependenciesdependentRequired, dependentSchemas
data_typestype, format
schemathesis:
enabled: true
max_examples: 100
hypothesis_phases:
- generate
- target
stateful_testing: true
base_url_override: null
auth_header: "Authorization"
auth_prefix: "APIToken"
字段描述
enabled开启/关闭 Schemathesis 测试。
max_examples每个操作生成的最大测试用例数。
hypothesis_phases要运行的 Hypothesis 阶段(generatetarget)。
stateful_testing启用跨操作的有状态链接测试。
base_url_override覆盖测试的 API 基础 URL。null 使用 api.base_url
auth_header用于身份验证的 HTTP 头名称。
auth_prefix令牌前缀格式(请求以 APIToken <token> 格式发送)。
reconciliation:
priority:
- existing
- discovery
- inferred
fix_strategies:
tighter_spec: "relax"
looser_spec: "tighten"
missing_constraint: "add"
extra_constraint: "remove"
字段描述
priority多个数据源存在分歧时的优先顺序。
fix_strategies将每种差异类型映射到其修复操作。参见已应用的修复
spectral:
enabled: true
ruleset: "spectral-pipeline.yaml"
auto_fix:
oas3-api-servers: true
info-contact: true
operation-tags: true
oas3-unused-component: true
operation-operationId-unique: true
oas3-valid-schema-example: true
no-script-tags-in-markdown: true
gate:
max_errors: null
max_warnings: null
contact:
name: "F5 Distributed Cloud"
url: "https://docs.cloud.f5.com"
email: "support@f5.com"
servers:
- url: "https://{tenant}.console.ves.volterra.io"
description: "F5 Distributed Cloud API"
variables:
tenant:
default: "example-tenant"
description: "Your F5 XC tenant name"
security_scheme:
type: "apiKey"
in: "header"
name: "Authorization"
description: "F5 XC API Token (format: APIToken <token>)"
字段描述
enabled完全开启/关闭 Spectral 检查。
ruleset使用的 Spectral 配置文件(流水线使用 spectral-pipeline.yaml)。
auto_fix规则名称到布尔值的映射。true 表示协调器将修复违规项。
gate.max_errors协调后门禁中允许的最大错误数。null 禁用该检查。
gate.max_warnings允许的最大警告数。null 禁用该检查。
contactinfo-contact 修复器注入到 info.contact 中的联系信息。
serversoas3-api-servers 修复器注入的服务器数组。
security_scheme注入到每个规范中的安全方案定义。
reports:
output_dir: "reports"
formats:
- json
- html
- markdown
include_examples: true
max_examples_per_issue: 5
release:
output_dir: "release"
include_changelog: true
include_validation_report: true
version_from: "git"
字段描述
output_dir发布产物的目录。
include_changelog在发布包中包含 CHANGELOG.md
include_validation_report在发布包中包含验证报告。
version_from版本来源。git 从规范元数据日期 + 补丁号派生版本。

定义用于实时 API 验证的基线端点。每个条目将逻辑资源名称映射到其规范文件、API 组和 CRUD 路径。

endpoints:
healthcheck:
resource: healthchecks
domain_file: docs-cloud-f5-com.0124.public.ves.io.schema.healthcheck.ves-swagger.json
api_group: config
crud_operations:
create: POST /api/config/namespaces/{namespace}/healthchecks
read: GET /api/config/namespaces/{namespace}/healthchecks/{name}
list: GET /api/config/namespaces/{namespace}/healthchecks
update: PUT /api/config/namespaces/{namespace}/healthchecks/{name}
delete: DELETE /api/config/namespaces/{namespace}/healthchecks/{name}
test_priority: high
description: "Health check configurations for origin monitoring"
字段描述
resourceAPI 资源名称(用于 URL 路径)。
domain_filespecs/original/ 中 OpenAPI 规范的文件名。
api_groupAPI 组前缀(configweb 等)。
crud_operations每个 CRUD 操作的 HTTP 方法和路径。
test_priorityhighmediumlow — 控制测试执行顺序。
description资源的可读描述。

跨三个领域的 10 个端点:

端点领域优先级
healthcheck虚拟high
origin_pool虚拟high
app_firewall虚拟high
service_policy虚拟medium
api_definitionAPI 安全high
api_discoveryAPI 安全medium
api_groupsAPI 安全medium
code_base_integrationAPI 安全low
data_type数据隐私medium
sensitive_data_policy数据隐私medium

要添加新的验证端点:

  1. specs/original/ 中找到规范文件名(格式:docs-cloud-f5-com.NNNN.*.ves-swagger.json
  2. 按照上述结构在 endpoints: 下添加一个条目
  3. domain_files: 下添加域文件映射及优先级编号
  4. 将端点名称添加到 test_order: 中的期望位置