iop/scripts/fixtures/iop-agent-smoke-manifest.schema.json

542 lines
12 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://iop.local/schemas/iop-agent-smoke-manifest.schema.json",
"title": "IOP Agent Logged Smoke Manifest",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"run_id",
"source",
"environment",
"lifecycle",
"projects",
"evidence"
],
"properties": {
"schema_version": {
"const": "2"
},
"run_id": {
"$ref": "#/$defs/digest"
},
"source": {
"type": "object",
"additionalProperties": false,
"required": [
"head",
"source_tree",
"binary_sha256",
"rebuilt_binary_sha256",
"binary_build_head",
"repo_config_sha256",
"local_config_sha256",
"provider_catalog_sha256",
"build_evidence_sha256",
"schema_sha256"
],
"properties": {
"head": {
"$ref": "#/$defs/revision"
},
"source_tree": {
"$ref": "#/$defs/revision"
},
"binary_sha256": {
"$ref": "#/$defs/digest"
},
"rebuilt_binary_sha256": {
"$ref": "#/$defs/digest"
},
"binary_build_head": {
"$ref": "#/$defs/revision"
},
"repo_config_sha256": {
"$ref": "#/$defs/digest"
},
"local_config_sha256": {
"$ref": "#/$defs/digest"
},
"provider_catalog_sha256": {
"$ref": "#/$defs/digest"
},
"build_evidence_sha256": {
"$ref": "#/$defs/digest"
},
"schema_sha256": {
"$ref": "#/$defs/digest"
}
}
},
"environment": {
"type": "object",
"additionalProperties": false,
"required": [
"os",
"arch"
],
"properties": {
"os": {
"const": "darwin"
},
"arch": {
"enum": [
"arm64",
"amd64"
]
}
}
},
"lifecycle": {
"type": "object",
"additionalProperties": false,
"required": [
"discovery",
"preview",
"manual_start",
"cancellation",
"sibling_continuation",
"new_invocation",
"restart_recovery",
"terminal_completion"
],
"properties": {
"discovery": {
"$ref": "#/$defs/verified_evidence"
},
"preview": {
"$ref": "#/$defs/verified_evidence"
},
"manual_start": {
"$ref": "#/$defs/verified_evidence"
},
"cancellation": {
"$ref": "#/$defs/verified_evidence"
},
"sibling_continuation": {
"$ref": "#/$defs/verified_evidence"
},
"new_invocation": {
"$ref": "#/$defs/verified_evidence"
},
"restart_recovery": {
"$ref": "#/$defs/verified_evidence"
},
"terminal_completion": {
"$ref": "#/$defs/verified_evidence"
}
}
},
"projects": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"slot",
"project_id_hash",
"workspace_revision",
"status_trace",
"terminal_status",
"initial_invocation_sha256",
"post_restart_invocation_sha256",
"locator_evidence_sha256",
"project_log_sha256",
"terminal_archive_sha256"
],
"properties": {
"slot": {
"enum": [
"a",
"b"
]
},
"project_id_hash": {
"$ref": "#/$defs/digest"
},
"workspace_revision": {
"$ref": "#/$defs/revision"
},
"status_trace": {
"type": "array",
"minItems": 3,
"maxItems": 16,
"items": {
"enum": [
"observed",
"started",
"running",
"stopped",
"blocked",
"completed",
"terminal_deferred"
]
}
},
"terminal_status": {
"const": "completed"
},
"initial_invocation_sha256": {
"$ref": "#/$defs/digest"
},
"post_restart_invocation_sha256": {
"$ref": "#/$defs/digest"
},
"locator_evidence_sha256": {
"$ref": "#/$defs/digest"
},
"project_log_sha256": {
"$ref": "#/$defs/digest"
},
"terminal_archive_sha256": {
"$ref": "#/$defs/digest"
}
}
}
},
"evidence": {
"type": "object",
"additionalProperties": false,
"required": [
"manifest_locator",
"schema_sha256",
"records"
],
"properties": {
"manifest_locator": {
"const": "manifest.json"
},
"schema_sha256": {
"$ref": "#/$defs/digest"
},
"records": {
"type": "array",
"minItems": 13,
"maxItems": 13,
"prefixItems": [
{
"$ref": "#/$defs/source_build_record"
},
{
"$ref": "#/$defs/discovery_quota_record"
},
{
"$ref": "#/$defs/preview_record"
},
{
"$ref": "#/$defs/state_transition_record"
},
{
"$ref": "#/$defs/cancellation_record"
},
{
"$ref": "#/$defs/locator_a_record"
},
{
"$ref": "#/$defs/locator_b_record"
},
{
"$ref": "#/$defs/restart_record"
},
{
"$ref": "#/$defs/project_log_a_record"
},
{
"$ref": "#/$defs/project_log_b_record"
},
{
"$ref": "#/$defs/archive_a_record"
},
{
"$ref": "#/$defs/archive_b_record"
},
{
"$ref": "#/$defs/terminal_record"
}
],
"items": false
}
}
}
},
"$defs": {
"digest": {
"type": "string",
"pattern": "^sha256:[0-9a-f]{64}$"
},
"revision": {
"type": "string",
"pattern": "^[0-9a-f]{40,64}$"
},
"verified_evidence": {
"type": "object",
"additionalProperties": false,
"required": [
"status",
"evidence_sha256"
],
"properties": {
"status": {
"const": "verified"
},
"evidence_sha256": {
"$ref": "#/$defs/digest"
}
}
},
"evidence_record": {
"type": "object",
"additionalProperties": false,
"required": [
"kind",
"locator",
"sha256"
],
"properties": {
"kind": {
"enum": [
"source_build",
"discovery_quota",
"preview",
"state_transition",
"cancellation",
"invocation_locator",
"restart",
"project_log",
"terminal_archive"
]
},
"locator": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9._-]{0,127}\\.json$"
},
"sha256": {
"$ref": "#/$defs/digest"
}
}
},
"source_build_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "source_build"
},
"locator": {
"const": "build-evidence.json"
}
}
}
]
},
"discovery_quota_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "discovery_quota"
},
"locator": {
"const": "discovery-quota.json"
}
}
}
]
},
"preview_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "preview"
},
"locator": {
"const": "preview-evidence.json"
}
}
}
]
},
"state_transition_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "state_transition"
},
"locator": {
"const": "start-evidence.json"
}
}
}
]
},
"cancellation_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "cancellation"
},
"locator": {
"const": "cancellation-evidence.json"
}
}
}
]
},
"locator_a_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "invocation_locator"
},
"locator": {
"const": "locator-a.json"
}
}
}
]
},
"locator_b_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "invocation_locator"
},
"locator": {
"const": "locator-b.json"
}
}
}
]
},
"restart_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "restart"
},
"locator": {
"const": "restart-evidence.json"
}
}
}
]
},
"project_log_a_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "project_log"
},
"locator": {
"const": "project-log-a.json"
}
}
}
]
},
"project_log_b_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "project_log"
},
"locator": {
"const": "project-log-b.json"
}
}
}
]
},
"archive_a_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "terminal_archive"
},
"locator": {
"const": "archive-a.json"
}
}
}
]
},
"archive_b_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "terminal_archive"
},
"locator": {
"const": "archive-b.json"
}
}
}
]
},
"terminal_record": {
"allOf": [
{
"$ref": "#/$defs/evidence_record"
},
{
"properties": {
"kind": {
"const": "terminal_archive"
},
"locator": {
"const": "terminal-evidence.json"
}
}
}
]
}
}
}