From 0605b373622c682fed9793ce05fddde2338f4811 Mon Sep 17 00:00:00 2001 From: Collin Pesicka Date: Fri, 10 May 2024 07:51:21 -0400 Subject: [PATCH] chore(schema): update --- uds.schema.json | 7 + zarf.schema.json | 540 +++++++++++++++++++++++++---------------------- 2 files changed, 290 insertions(+), 257 deletions(-) diff --git a/uds.schema.json b/uds.schema.json index 1030a301c..c20149c98 100644 --- a/uds.schema.json +++ b/uds.schema.json @@ -120,6 +120,13 @@ "type": "string", "description": "Description of the Zarf package" }, + "images": { + "items": { + "type": "string" + }, + "type": "array", + "description": "List of images included in the Zarf package" + }, "repository": { "type": "string", "description": "The repository to import the package from" diff --git a/zarf.schema.json b/zarf.schema.json index 27a8a89a4..69f4aae9d 100644 --- a/zarf.schema.json +++ b/zarf.schema.json @@ -1,8 +1,11 @@ { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/defenseunicorns/zarf/src/types/zarf-package", - "$defs": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfPackage", + "definitions": { "BigBang": { + "required": [ + "version" + ], "properties": { "version": { "type": "string", @@ -33,43 +36,6 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "version" - ], - "patternProperties": { - "^x-": {} - } - }, - "Constant": { - "properties": { - "name": { - "type": "string", - "pattern": "^[A-Z0-9_]+$", - "description": "The name to be used for the constant" - }, - "value": { - "type": "string", - "description": "The value to set for the constant during deploy" - }, - "description": { - "type": "string", - "description": "A description of the constant to explain its purpose on package create or deploy confirmation prompts" - }, - "autoIndent": { - "type": "boolean", - "description": "Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_CONST_." - }, - "pattern": { - "type": "string", - "description": "An optional regex pattern that a constant value must match before a package can be created." - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "name", - "value" - ], "patternProperties": { "^x-": {} } @@ -116,55 +82,6 @@ "^x-": {} } }, - "InteractiveVariable": { - "properties": { - "name": { - "type": "string", - "pattern": "^[A-Z0-9_]+$", - "description": "The name to be used for the variable" - }, - "sensitive": { - "type": "boolean", - "description": "Whether to mark this variable as sensitive to not print it in the log" - }, - "autoIndent": { - "type": "boolean", - "description": "Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_VAR_." - }, - "pattern": { - "type": "string", - "description": "An optional regex pattern that a variable value must match before a package deployment can continue." - }, - "type": { - "type": "string", - "enum": [ - "raw", - "file" - ], - "description": "Changes the handling of a variable to load contents differently (i.e. from a file rather than as a raw variable - templated files should be kept below 1 MiB)" - }, - "description": { - "type": "string", - "description": "A description of the variable to be used when prompting the user a value" - }, - "default": { - "type": "string", - "description": "The default value to use for the variable" - }, - "prompt": { - "type": "boolean", - "description": "Whether to prompt the user for input for this variable" - } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "name" - ], - "patternProperties": { - "^x-": {} - } - }, "Shell": { "properties": { "windows": { @@ -208,44 +125,14 @@ "^x-": {} } }, - "Variable": { - "properties": { - "name": { - "type": "string", - "pattern": "^[A-Z0-9_]+$", - "description": "The name to be used for the variable" - }, - "sensitive": { - "type": "boolean", - "description": "Whether to mark this variable as sensitive to not print it in the log" - }, - "autoIndent": { - "type": "boolean", - "description": "Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_VAR_." - }, - "pattern": { - "type": "string", - "description": "An optional regex pattern that a variable value must match before a package deployment can continue." - }, - "type": { - "type": "string", - "enum": [ - "raw", - "file" - ], - "description": "Changes the handling of a variable to load contents differently (i.e. from a file rather than as a raw variable - templated files should be kept below 1 MiB)" - } - }, - "additionalProperties": false, - "type": "object", + "ZarfBuildData": { "required": [ - "name" + "terminal", + "user", + "architecture", + "timestamp", + "version" ], - "patternProperties": { - "^x-": {} - } - }, - "ZarfBuildData": { "properties": { "terminal": { "type": "string", @@ -275,8 +162,10 @@ "description": "Any migrations that have been run on this package" }, "registryOverrides": { - "additionalProperties": { - "type": "string" + "patternProperties": { + ".*": { + "type": "string" + } }, "type": "object", "description": "Any registry domains that were overridden on package create when pulling images" @@ -307,18 +196,15 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "terminal", - "user", - "architecture", - "timestamp", - "version" - ], "patternProperties": { "^x-": {} } }, "ZarfChart": { + "required": [ + "name", + "namespace" + ], "properties": { "name": { "type": "string", @@ -373,7 +259,8 @@ }, "variables": { "items": { - "$ref": "#/$defs/ZarfChartVariable" + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfChartVariable" }, "type": "array", "description": "[alpha] List of variables to set in the Helm chart" @@ -381,19 +268,20 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "name", - "namespace" - ], "patternProperties": { "^x-": {} } }, "ZarfChartVariable": { + "required": [ + "name", + "description", + "path" + ], "properties": { "name": { - "type": "string", "pattern": "^[A-Z0-9_]+$", + "type": "string", "description": "The name of the variable" }, "description": { @@ -407,20 +295,18 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "name", - "description", - "path" - ], "patternProperties": { "^x-": {} } }, "ZarfComponent": { + "required": [ + "name" + ], "properties": { "name": { - "type": "string", "pattern": "^[a-z0-9\\-]*[a-z0-9]$", + "type": "string", "description": "The name of the component" }, "description": { @@ -436,7 +322,8 @@ "description": "Do not prompt user to install this component" }, "only": { - "$ref": "#/$defs/ZarfComponentOnlyTarget", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentOnlyTarget", "description": "Filter when this component is included in package creation or deployment" }, "group": { @@ -448,33 +335,38 @@ "description": "[Deprecated] Specify a path to a public key to validate signed online resources. This will be removed in Zarf v1.0.0." }, "import": { - "$ref": "#/$defs/ZarfComponentImport", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentImport", "description": "Import a component from another Zarf package" }, "manifests": { "items": { - "$ref": "#/$defs/ZarfManifest" + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfManifest" }, "type": "array", "description": "Kubernetes manifests to be included in a generated Helm chart on package deploy" }, "charts": { "items": { - "$ref": "#/$defs/ZarfChart" + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfChart" }, "type": "array", "description": "Helm charts to install during package deploy" }, "dataInjections": { "items": { - "$ref": "#/$defs/ZarfDataInjection" + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfDataInjection" }, "type": "array", "description": "Datasets to inject into a container in the target cluster" }, "files": { "items": { - "$ref": "#/$defs/ZarfFile" + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfFile" }, "type": "array", "description": "Files or folders to place on disk during package deployment" @@ -494,23 +386,23 @@ "description": "List of git repos to include in the package" }, "extensions": { - "$ref": "#/$defs/ZarfComponentExtensions", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentExtensions", "description": "Extend component functionality with additional features" }, "scripts": { - "$ref": "#/$defs/DeprecatedZarfComponentScripts", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/DeprecatedZarfComponentScripts", "description": "[Deprecated] (replaced by actions) Custom commands to run before or after package deployment. This will be removed in Zarf v1.0.0." }, "actions": { - "$ref": "#/$defs/ZarfComponentActions", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentActions", "description": "Custom commands to run at various stages of a package lifecycle" } }, "additionalProperties": false, "type": "object", - "required": [ - "name" - ], "patternProperties": { "^x-": {} } @@ -545,17 +437,18 @@ "description": "The command to run. Must specify either cmd or wait for the action to do anything." }, "shell": { - "$ref": "#/$defs/Shell", + "$ref": "#/definitions/Shell", "description": "(cmd only) Indicates a preference for a shell for the provided cmd to be executed in on supported operating systems" }, "setVariable": { - "type": "string", "pattern": "^[A-Z0-9_]+$", + "type": "string", "description": "[Deprecated] (replaced by setVariables) (onDeploy/cmd only) The name of a variable to update with the output of the command. This variable will be available to all remaining actions and components in the package. This will be removed in Zarf v1.0.0" }, "setVariables": { "items": { - "$ref": "#/$defs/Variable" + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentActionSetVariable" }, "type": "array", "description": "(onDeploy/cmd only) An array of variables to update with the output of the command. These variables will be available to all remaining actions and components in the package." @@ -565,7 +458,8 @@ "description": "Description of the action to be displayed during package execution instead of the command" }, "wait": { - "$ref": "#/$defs/ZarfComponentActionWait", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentActionWait", "description": "Wait for a condition to be met before continuing. Must specify either cmd or wait for the action. See the 'zarf tools wait-for' command for more info." } }, @@ -601,7 +495,8 @@ "description": "Additional environment variables for commands" }, "shell": { - "$ref": "#/$defs/Shell", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Shell", "description": "(cmd only) Indicates a preference for a shell for the provided cmd to be executed in on supported operating systems" } }, @@ -614,33 +509,35 @@ "ZarfComponentActionSet": { "properties": { "defaults": { - "$ref": "#/$defs/ZarfComponentActionDefaults", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentActionDefaults", "description": "Default configuration for all actions in this set" }, "before": { "items": { - "$ref": "#/$defs/ZarfComponentAction" + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentAction" }, "type": "array", "description": "Actions to run at the start of an operation" }, "after": { "items": { - "$ref": "#/$defs/ZarfComponentAction" + "$ref": "#/definitions/ZarfComponentAction" }, "type": "array", "description": "Actions to run at the end of an operation" }, "onSuccess": { "items": { - "$ref": "#/$defs/ZarfComponentAction" + "$ref": "#/definitions/ZarfComponentAction" }, "type": "array", "description": "Actions to run if all operations succeed" }, "onFailure": { "items": { - "$ref": "#/$defs/ZarfComponentAction" + "$ref": "#/definitions/ZarfComponentAction" }, "type": "array", "description": "Actions to run if all operations fail" @@ -652,14 +549,53 @@ "^x-": {} } }, + "ZarfComponentActionSetVariable": { + "required": [ + "name" + ], + "properties": { + "name": { + "pattern": "^[A-Z0-9_]+$", + "type": "string", + "description": "The name to be used for the variable" + }, + "type": { + "enum": [ + "raw", + "file" + ], + "type": "string", + "description": "Changes the handling of a variable to load contents differently (i.e. from a file rather than as a raw variable - templated files should be kept below 1 MiB)" + }, + "pattern": { + "type": "string", + "description": "An optional regex pattern that a variable value must match before a package deployment can continue." + }, + "sensitive": { + "type": "boolean", + "description": "Whether to mark this variable as sensitive to not print it in the Zarf log" + }, + "autoIndent": { + "type": "boolean", + "description": "Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_VAR_." + } + }, + "additionalProperties": false, + "type": "object", + "patternProperties": { + "^x-": {} + } + }, "ZarfComponentActionWait": { "properties": { "cluster": { - "$ref": "#/$defs/ZarfComponentActionWaitCluster", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentActionWaitCluster", "description": "Wait for a condition to be met in the cluster before continuing. Only one of cluster or network can be specified." }, "network": { - "$ref": "#/$defs/ZarfComponentActionWaitNetwork", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentActionWaitNetwork", "description": "Wait for a condition to be met on the network before continuing. Only one of cluster or network can be specified." } }, @@ -670,6 +606,10 @@ } }, "ZarfComponentActionWaitCluster": { + "required": [ + "kind", + "name" + ], "properties": { "kind": { "type": "string", @@ -702,23 +642,23 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "kind", - "name" - ], "patternProperties": { "^x-": {} } }, "ZarfComponentActionWaitNetwork": { + "required": [ + "protocol", + "address" + ], "properties": { "protocol": { - "type": "string", "enum": [ "tcp", "http", "https" ], + "type": "string", "description": "The protocol to wait for" }, "address": { @@ -740,10 +680,6 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "protocol", - "address" - ], "patternProperties": { "^x-": {} } @@ -751,15 +687,16 @@ "ZarfComponentActions": { "properties": { "onCreate": { - "$ref": "#/$defs/ZarfComponentActionSet", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentActionSet", "description": "Actions to run during package creation" }, "onDeploy": { - "$ref": "#/$defs/ZarfComponentActionSet", + "$ref": "#/definitions/ZarfComponentActionSet", "description": "Actions to run during package deployment" }, "onRemove": { - "$ref": "#/$defs/ZarfComponentActionSet", + "$ref": "#/definitions/ZarfComponentActionSet", "description": "Actions to run during package removal" } }, @@ -772,7 +709,8 @@ "ZarfComponentExtensions": { "properties": { "bigbang": { - "$ref": "#/$defs/BigBang", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/BigBang", "description": "Configurations for installing Big Bang and Flux in the cluster" } }, @@ -793,8 +731,8 @@ "description": "The relative path to a directory containing a zarf.yaml to import from" }, "url": { - "type": "string", "pattern": "^oci://.*$", + "type": "string", "description": "[beta] The URL to a Zarf package to import via OCI" } }, @@ -807,20 +745,16 @@ "ZarfComponentOnlyCluster": { "properties": { "architecture": { - "type": "string", "enum": [ "amd64", "arm64" ], + "type": "string", "description": "Only create and deploy to clusters of the given architecture" }, "distros": { "items": { - "type": "string", - "examples": [ - "k3s", - "eks" - ] + "type": "string" }, "type": "array", "description": "A list of kubernetes distros this package works with (Reserved for future use)" @@ -835,16 +769,17 @@ "ZarfComponentOnlyTarget": { "properties": { "localOS": { - "type": "string", "enum": [ "linux", "darwin", "windows" ], + "type": "string", "description": "Only deploy component to specified OS" }, "cluster": { - "$ref": "#/$defs/ZarfComponentOnlyCluster", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponentOnlyCluster", "description": "Only deploy component to specified clusters" }, "flavor": { @@ -859,6 +794,12 @@ } }, "ZarfContainerTarget": { + "required": [ + "namespace", + "selector", + "container", + "path" + ], "properties": { "namespace": { "type": "string", @@ -882,24 +823,23 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "namespace", - "selector", - "container", - "path" - ], "patternProperties": { "^x-": {} } }, "ZarfDataInjection": { + "required": [ + "source", + "target" + ], "properties": { "source": { "type": "string", "description": "Either a path to a local folder/file or a remote URL of a file to inject into the given target pod + container" }, "target": { - "$ref": "#/$defs/ZarfContainerTarget", + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfContainerTarget", "description": "The target pod + container to inject the data into" }, "compress": { @@ -909,15 +849,15 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "source", - "target" - ], "patternProperties": { "^x-": {} } }, "ZarfFile": { + "required": [ + "source", + "target" + ], "properties": { "source": { "type": "string", @@ -949,15 +889,14 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "source", - "target" - ], "patternProperties": { "^x-": {} } }, "ZarfManifest": { + "required": [ + "name" + ], "properties": { "name": { "type": "string", @@ -992,18 +931,18 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "name" - ], "patternProperties": { "^x-": {} } }, "ZarfMetadata": { + "required": [ + "name" + ], "properties": { "name": { - "type": "string", "pattern": "^[a-z0-9\\-]*[a-z0-9]$", + "type": "string", "description": "Name to identify this Zarf package" }, "description": { @@ -1064,61 +1003,148 @@ }, "additionalProperties": false, "type": "object", - "required": [ - "name" - ], "patternProperties": { "^x-": {} } - } - }, - "properties": { - "kind": { - "type": "string", - "enum": [ - "ZarfInitConfig", - "ZarfPackageConfig" - ], - "description": "The kind of Zarf package", - "default": "ZarfPackageConfig" - }, - "metadata": { - "$ref": "#/$defs/ZarfMetadata", - "description": "Package metadata" - }, - "build": { - "$ref": "#/$defs/ZarfBuildData", - "description": "Zarf-generated package build data" }, - "components": { - "items": { - "$ref": "#/$defs/ZarfComponent" + "ZarfPackage": { + "required": [ + "kind", + "components" + ], + "properties": { + "kind": { + "enum": [ + "ZarfInitConfig", + "ZarfPackageConfig" + ], + "type": "string", + "description": "The kind of Zarf package", + "default": "ZarfPackageConfig" + }, + "metadata": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfMetadata", + "description": "Package metadata" + }, + "build": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfBuildData", + "description": "Zarf-generated package build data" + }, + "components": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfComponent" + }, + "type": "array", + "description": "List of components to deploy in this package" + }, + "constants": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfPackageConstant" + }, + "type": "array", + "description": "Constant template values applied on deploy for K8s resources" + }, + "variables": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ZarfPackageVariable" + }, + "type": "array", + "description": "Variable template values applied on deploy for K8s resources" + } }, - "type": "array", - "description": "List of components to deploy in this package" + "additionalProperties": false, + "type": "object", + "patternProperties": { + "^x-": {} + } }, - "constants": { - "items": { - "$ref": "#/$defs/Constant" + "ZarfPackageConstant": { + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "pattern": "^[A-Z0-9_]+$", + "type": "string", + "description": "The name to be used for the constant" + }, + "value": { + "type": "string", + "description": "The value to set for the constant during deploy" + }, + "description": { + "type": "string", + "description": "A description of the constant to explain its purpose on package create or deploy confirmation prompts" + }, + "autoIndent": { + "type": "boolean", + "description": "Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_CONST_." + }, + "pattern": { + "type": "string", + "description": "An optional regex pattern that a constant value must match before a package can be created." + } }, - "type": "array", - "description": "Constant template values applied on deploy for K8s resources" + "additionalProperties": false, + "type": "object", + "patternProperties": { + "^x-": {} + } }, - "variables": { - "items": { - "$ref": "#/$defs/InteractiveVariable" + "ZarfPackageVariable": { + "required": [ + "name" + ], + "properties": { + "name": { + "pattern": "^[A-Z0-9_]+$", + "type": "string", + "description": "The name to be used for the variable" + }, + "description": { + "type": "string", + "description": "A description of the variable to be used when prompting the user a value" + }, + "default": { + "type": "string", + "description": "The default value to use for the variable" + }, + "prompt": { + "type": "boolean", + "description": "Whether to prompt the user for input for this variable" + }, + "sensitive": { + "type": "boolean", + "description": "Whether to mark this variable as sensitive to not print it in the Zarf log" + }, + "autoIndent": { + "type": "boolean", + "description": "Whether to automatically indent the variable's value (if multiline) when templating. Based on the number of chars before the start of ###ZARF_VAR_." + }, + "pattern": { + "type": "string", + "description": "An optional regex pattern that a variable value must match before a package can be deployed." + }, + "type": { + "enum": [ + "raw", + "file" + ], + "type": "string", + "description": "Changes the handling of a variable to load contents differently (i.e. from a file rather than as a raw variable - templated files should be kept below 1 MiB)" + } }, - "type": "array", - "description": "Variable template values applied on deploy for K8s resources" + "additionalProperties": false, + "type": "object", + "patternProperties": { + "^x-": {} + } } - }, - "additionalProperties": false, - "type": "object", - "required": [ - "kind", - "components" - ], - "patternProperties": { - "^x-": {} } }