151 lines
9.7 KiB
JSON
151 lines
9.7 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "urn:archipelago:schema:layer:v1",
|
|
"title": "Archipelago Layer v1",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["apiVersion", "kind", "metadata", "spec"],
|
|
"properties": {
|
|
"apiVersion": {"const": "archipelago/v1"},
|
|
"kind": {"const": "Layer"},
|
|
"metadata": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["name", "version"],
|
|
"properties": {
|
|
"name": {"$ref": "#/$defs/id"},
|
|
"version": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*))?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(?![\\s\\S])"}
|
|
}
|
|
},
|
|
"spec": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["type", "architecture"],
|
|
"properties": {
|
|
"type": {"enum": ["core", "purpose", "overlay"]},
|
|
"architecture": {"const": "x86_64"},
|
|
"purpose": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["role", "variant"],
|
|
"properties": {"role": {"enum": ["desktop", "server", "iot"]}, "variant": {"$ref": "#/$defs/localId"}}
|
|
},
|
|
"packages": {
|
|
"type": "object", "additionalProperties": false, "default": {},
|
|
"properties": {
|
|
"runtime": {"$ref": "#/$defs/requirements"},
|
|
"build": {"$ref": "#/$defs/requirements"},
|
|
"replacements": {
|
|
"type": "array", "default": [], "uniqueItems": true,
|
|
"items": {
|
|
"type": "object", "additionalProperties": false,
|
|
"required": ["target", "replacement", "expected_owner", "reason"],
|
|
"properties": {"target": {"$ref": "#/$defs/packageName"}, "replacement": {"$ref": "#/$defs/packageName"}, "expected_owner": {"$ref": "#/$defs/id"}, "reason": {"$ref": "#/$defs/nonempty"}}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"compatibility": {
|
|
"type": "object", "additionalProperties": false, "default": {},
|
|
"properties": {
|
|
"core": {"$ref": "#/$defs/ids"}, "purpose": {"$ref": "#/$defs/ids"},
|
|
"requires": {"$ref": "#/$defs/ids"}, "conflicts": {"$ref": "#/$defs/ids"},
|
|
"before": {"$ref": "#/$defs/ids"}, "after": {"$ref": "#/$defs/ids"},
|
|
"kernel": {
|
|
"type": "object", "additionalProperties": false, "required": ["package", "release", "abi"],
|
|
"properties": {
|
|
"package": {
|
|
"type": "object", "additionalProperties": false, "required": ["name", "version", "architecture", "archive_sha256"],
|
|
"properties": {"name": {"$ref": "#/$defs/packageName"}, "version": {"$ref": "#/$defs/nonempty"}, "architecture": {"const": "x86_64"}, "archive_sha256": {"$ref": "#/$defs/digest"}}
|
|
},
|
|
"release": {"type": "string", "pattern": "^[A-Za-z0-9_+.-]+(?![\\s\\S])"},
|
|
"abi": {"type": "object", "additionalProperties": false, "required": ["adapter", "digest"], "properties": {"adapter": {"$ref": "#/$defs/adapter"}, "digest": {"$ref": "#/$defs/digest"}}}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"files": {"type": "array", "default": [], "items": {"$ref": "#/$defs/file"}},
|
|
"overrides": {"type": "array", "default": [], "items": {"$ref": "#/$defs/override"}},
|
|
"actions": {"type": "array", "default": [], "items": {"$ref": "#/$defs/action"}},
|
|
"runtime": {
|
|
"type": "object", "additionalProperties": false, "default": {},
|
|
"properties": {
|
|
"sysusers": {"$ref": "#/$defs/vendorPaths"}, "tmpfiles": {"$ref": "#/$defs/vendorPaths"}, "presets": {"$ref": "#/$defs/vendorPaths"},
|
|
"units": {
|
|
"type": "array", "default": [], "items": {
|
|
"type": "object", "additionalProperties": false, "required": ["name", "activation"],
|
|
"properties": {"name": {"type": "string", "pattern": "^[^/\\s]+\\.(service|socket|target|timer|path|mount|automount|swap)(?![\\s\\S])"}, "activation": {"enum": ["enable", "socket", "manual"]}},
|
|
"if": {"properties": {"activation": {"const": "socket"}}},
|
|
"then": {"properties": {"name": {"pattern": "\\.socket$"}}}
|
|
}
|
|
},
|
|
"provisioner": {"$ref": "#/$defs/adapter"},
|
|
"boot_checks": {"$ref": "#/$defs/localIds"}, "functional_checks": {"$ref": "#/$defs/localIds"}
|
|
}
|
|
}
|
|
},
|
|
"allOf": [
|
|
{"if": {"properties": {"type": {"const": "purpose"}}}, "then": {"required": ["purpose"]}, "else": {"not": {"required": ["purpose"]}}},
|
|
{"if": {"properties": {"type": {"const": "core"}}}, "then": {"properties": {
|
|
"packages": {"not": {"required": ["replacements"]}},
|
|
"compatibility": {"not": {"anyOf": [{"required": ["core"]}, {"required": ["purpose"]}, {"required": ["requires"]}, {"required": ["conflicts"]}, {"required": ["before"]}, {"required": ["after"]}]}}
|
|
}}},
|
|
{"if": {"properties": {"type": {"const": "purpose"}}}, "then": {"properties": {"compatibility": {"not": {"anyOf": [{"required": ["purpose"]}, {"required": ["before"]}, {"required": ["after"]}]}}}}}
|
|
]
|
|
}
|
|
},
|
|
"$defs": {
|
|
"nonempty": {"type": "string", "minLength": 1, "pattern": "\\S"},
|
|
"id": {"type": "string", "maxLength": 128, "pattern": "^[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)*(?![\\s\\S])"},
|
|
"localId": {"type": "string", "maxLength": 128, "pattern": "^[a-z0-9][a-z0-9._-]*(?![\\s\\S])"},
|
|
"adapter": {"$ref": "#/$defs/id"},
|
|
"digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}(?![\\s\\S])"},
|
|
"packageName": {"type": "string", "pattern": "^[A-Za-z0-9_+@][A-Za-z0-9_+@.-]*(?![\\s\\S])"},
|
|
"identity": {"type": "string", "pattern": "^[a-z_][a-z0-9_-]*[$]?(?![\\s\\S])"},
|
|
"path": {"type": "string", "pattern": "^(?!.*(?:^|/)\\.\\.?(?:/|$))/(?:[^/\\r\\n]+/)*[^/\\r\\n]+(?![\\s\\S])"},
|
|
"ids": {"type": "array", "default": [], "uniqueItems": true, "items": {"$ref": "#/$defs/id"}},
|
|
"localIds": {"type": "array", "default": [], "uniqueItems": true, "items": {"$ref": "#/$defs/localId"}},
|
|
"strings": {"type": "array", "default": [], "items": {"type": "string"}},
|
|
"vendorPaths": {"type": "array", "default": [], "uniqueItems": true, "items": {"allOf": [{"$ref": "#/$defs/path"}, {"pattern": "^/usr/"}]}},
|
|
"requirements": {"type": "array", "default": [], "uniqueItems": true, "items": {
|
|
"type": "object", "additionalProperties": false, "required": ["name"],
|
|
"properties": {"name": {"$ref": "#/$defs/packageName"}, "constraint": {"type": "string", "pattern": "^(>=|<=|=|>|<)[^<>=\\s]+(?![\\s\\S])"}}
|
|
}},
|
|
"file": {
|
|
"type": "object", "additionalProperties": false, "required": ["path", "mode", "owner", "group"],
|
|
"properties": {
|
|
"type": {"enum": ["file", "directory", "symlink"], "default": "file"},
|
|
"source": {"type": "string", "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*//)[^\\r\\n]+(?![\\s\\S])"},
|
|
"target": {"$ref": "#/$defs/nonempty"}, "path": {"$ref": "#/$defs/path"},
|
|
"mode": {"type": "string", "pattern": "^0?[0-7]{4}(?![\\s\\S])"},
|
|
"owner": {"$ref": "#/$defs/identity"}, "group": {"$ref": "#/$defs/identity"}
|
|
},
|
|
"allOf": [
|
|
{"if": {"properties": {"type": {"const": "file"}}}, "then": {"required": ["source"], "not": {"required": ["target"]}}},
|
|
{"if": {"required": ["type"], "properties": {"type": {"const": "directory"}}}, "then": {"not": {"anyOf": [{"required": ["source"]}, {"required": ["target"]}]}}},
|
|
{"if": {"required": ["type"], "properties": {"type": {"const": "symlink"}}}, "then": {"required": ["target"], "not": {"required": ["source"]}, "properties": {"mode": {"const": "0777"}}}}
|
|
]
|
|
},
|
|
"override": {
|
|
"type": "object", "additionalProperties": false, "required": ["operation", "paths", "expected_owner", "reason"],
|
|
"properties": {
|
|
"operation": {"enum": ["replace-file", "replace-symlink", "set-metadata", "change-type", "delete-path"]},
|
|
"paths": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"$ref": "#/$defs/path"}},
|
|
"expected_owner": {"type": "object", "additionalProperties": false, "required": ["layer"], "properties": {"layer": {"$ref": "#/$defs/id"}, "package": {"$ref": "#/$defs/packageName"}}},
|
|
"reason": {"$ref": "#/$defs/nonempty"},
|
|
"expected_sha256": {"type": "object", "propertyNames": {"$ref": "#/$defs/path"}, "additionalProperties": {"$ref": "#/$defs/digest"}},
|
|
"metadata": {"type": "object", "additionalProperties": false, "minProperties": 1, "properties": {"mode": {"type": "string", "pattern": "^0?[0-7]{4}(?![\\s\\S])"}, "owner": {"$ref": "#/$defs/identity"}, "group": {"$ref": "#/$defs/identity"}}}
|
|
},
|
|
"if": {"properties": {"operation": {"const": "set-metadata"}}},
|
|
"then": {"required": ["metadata"]}, "else": {"not": {"required": ["metadata"]}}
|
|
},
|
|
"action": {
|
|
"type": "object", "additionalProperties": false, "required": ["id", "phase", "adapter", "timeout_seconds", "network"],
|
|
"properties": {
|
|
"id": {"$ref": "#/$defs/localId"}, "phase": {"enum": ["build-local", "finalize", "deploy", "runtime"]},
|
|
"adapter": {"$ref": "#/$defs/adapter"}, "argv": {"$ref": "#/$defs/strings"},
|
|
"inputs": {"$ref": "#/$defs/strings"}, "outputs": {"$ref": "#/$defs/strings"}, "after": {"$ref": "#/$defs/localIds"},
|
|
"timeout_seconds": {"type": "integer", "minimum": 1, "maximum": 9007199254740991},
|
|
"required": {"type": "boolean", "default": true}, "network": {"enum": ["none", "allowed"]}
|
|
},
|
|
"if": {"properties": {"phase": {"const": "finalize"}}}, "then": {"properties": {"network": {"const": "none"}}}
|
|
}
|
|
}
|
|
}
|