UNPKG

@enspirit/emb

Version:

A replacement for our Makefile-for-monorepos

546 lines (545 loc) 19.3 kB
{ "$id": "/schemas/config", "$schema": "http://json-schema.org/draft-07/schema#", "title": "EMBConfig", "type": "object", "additionalProperties": false, "properties": { "project": { "type": "object", "required": ["name"], "properties": { "name": { "$ref": "#/definitions/Identifier", "description": "The name of the project." }, "rootDir": { "type": "string", "minLength": 1, "description": "The root directory of the project." } }, "additionalProperties": false }, "plugins": { "type": "array", "items": { "$ref": "#/definitions/PluginConfigItem" } }, "env": { "type": "object", "description": "Variables to install on the environment", "additionalProperties": { "type": "string" } }, "vars": { "type": "object", "description": "Variables that will be accessible for string expansion", "additionalProperties": true }, "defaults": { "$ref": "#/definitions/DefaultsConfig" }, "components": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ComponentConfig" } }, "flavors": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ProjectFlavorConfig" } }, "tasks": { "type": "object", "additionalProperties": { "$ref": "#/definitions/TaskConfig" } } }, "required": ["project"], "definitions": { "Identifier": { "type": "string", "pattern": "^[a-zA-Z]+[\\w._-]+$" }, "QualifiedIdentifier": { "type": "string", "pattern": "^([a-zA-Z]+[\\w._-]+:)?[a-zA-Z]+[\\w._-]+$" }, "DefaultsConfig": { "type": "object", "description": "Default settings for build aspects", "additionalProperties": false, "properties": { "docker": { "type": "object", "description": "Default docker build settings", "properties": { "tag": { "type": "string" }, "target": { "$ref": "#/definitions/Identifier" }, "buildArgs": { "type": "object", "additionalProperties": { "type": "string" } }, "labels": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "TaskConfig": { "type": "object", "required": [], "anyOf": [ { "required": ["script"] }, { "required": ["pre"] } ], "properties": { "description": { "type": "string" }, "script": { "type": "string" }, "executor": { "$ref": "#/definitions/Identifier" }, "options": { "type": "object", "additionalProperties": true }, "pre": { "type": "array", "items": { "$ref": "#/definitions/QualifiedIdentifier" } }, "executors": { "type": "array", "items": { "anyOf": [ { "const": "local" }, { "const": "container" } ] } }, "interactive": { "type": "boolean", "description": "Whether the task is interactive (requires TTY)", "default": false }, "vars": { "type": "object", "description": "Variables to pass onto the task", "additionalProperties": { "type": "string" } }, "confirm": { "type": "object", "description": "Ask for user confirmation before running task", "required": ["message"], "properties": { "message": { "type": "string" }, "expect": { "type": "string" } } } }, "additionalProperties": false }, "ComponentConfig": { "type": "object", "required": [], "properties": { "rootDir": { "type": "string", "description": "Path to the component's root folder (relative to root of monorepo)" }, "description": { "type": "string", "minLength": 1, "description": "A description of the component." }, "tasks": { "type": "object", "additionalProperties": { "$ref": "#/definitions/TaskConfig" } }, "resources": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ResourceConfig" } }, "flavors": { "type": "object", "additionalProperties": { "$ref": "#/definitions/ComponentFlavorConfig" } } }, "additionalProperties": false }, "DockerImageConfig": { "type": "object", "properties": { "buildArgs": { "type": "object", "properties": {}, "additionalProperties": { "type": "string" } }, "target": { "type": "string", "description": "The stage to target for the build" }, "labels": { "type": "object", "additionalProperties": { "type": "string" }, "description": "Labels to apply to the resulting image" }, "context": { "type": "string", "description": "The context folder for the docker build" }, "dockerfile": { "type": "string", "description": "The Dockerfile to use" } }, "additionalProperties": false }, "ProjectFlavorConfig": { "type": "object", "additionalProperties": false, "required": [], "properties": { "patches": { "type": "array", "items": { "$ref": "#/definitions/JsonPatchOperation" } } } }, "ResourceConfig": { "type": "object", "required": ["type"], "properties": { "type": { "type": "string" }, "params": {}, "dependencies": { "type": "array", "items": { "$ref": "#/definitions/QualifiedIdentifier" }, "uniqueItems": true } }, "additionalProperties": false, "allOf": [ { "if": { "properties": { "type": { "const": "docker/image" } }, "required": ["type"] }, "then": { "properties": { "params": { "$ref": "#/definitions/DockerImageConfig" } } } }, { "if": { "properties": { "type": { "const": "file" } }, "required": ["type"] }, "then": { "properties": { "params": { "type": "object", "additionalProperties": false, "properties": { "path": { "type": "string" }, "script": { "type": "string" } } } } } } ] }, "ComponentFlavorConfig": { "type": "object", "additionalProperties": false, "required": [], "properties": { "patches": { "type": "array", "items": { "$ref": "#/definitions/JsonPatchOperation" } } } }, "JsonPatchAddOperation": { "type": "object", "properties": { "op": { "const": "add" }, "path": { "type": "string", "minLength": 1 }, "value": {} }, "required": ["op", "path", "value"], "additionalProperties": false }, "JsonPatchRemoveOperation": { "type": "object", "properties": { "op": { "const": "remove" }, "path": { "type": "string", "minLength": 1 } }, "required": ["op", "path"], "additionalProperties": false }, "JsonPatchReplaceOperation": { "type": "object", "properties": { "op": { "const": "replace" }, "path": { "type": "string", "minLength": 1 }, "value": {} }, "required": ["op", "path", "value"], "additionalProperties": false }, "JsonPatchMoveOperation": { "type": "object", "properties": { "op": { "const": "move" }, "path": { "type": "string", "minLength": 1 }, "from": { "type": "string", "minLength": 1 } }, "required": ["op", "path", "from"], "additionalProperties": false }, "JsonPatchCopyOperation": { "type": "object", "properties": { "op": { "const": "copy" }, "path": { "type": "string", "minLength": 1 }, "from": { "type": "string", "minLength": 1 } }, "required": ["op", "path", "from"], "additionalProperties": false }, "JsonPatchOperation": { "oneOf": [ { "$ref": "#/definitions/JsonPatchAddOperation" }, { "$ref": "#/definitions/JsonPatchRemoveOperation" }, { "$ref": "#/definitions/JsonPatchReplaceOperation" }, { "$ref": "#/definitions/JsonPatchMoveOperation" }, { "$ref": "#/definitions/JsonPatchCopyOperation" } ] }, "VaultTokenAuth": { "type": "object", "required": ["method", "token"], "properties": { "method": { "const": "token" }, "token": { "type": "string", "description": "Vault token for authentication" } }, "additionalProperties": false }, "VaultAppRoleAuth": { "type": "object", "required": ["method", "roleId", "secretId"], "properties": { "method": { "const": "approle" }, "roleId": { "type": "string", "description": "AppRole role ID" }, "secretId": { "type": "string", "description": "AppRole secret ID" } }, "additionalProperties": false }, "VaultKubernetesAuth": { "type": "object", "required": ["method", "role"], "properties": { "method": { "const": "kubernetes" }, "role": { "type": "string", "description": "Kubernetes auth role name" } }, "additionalProperties": false }, "VaultJwtAuth": { "type": "object", "required": ["method", "role", "jwt"], "properties": { "method": { "const": "jwt" }, "role": { "type": "string", "description": "JWT auth role name" }, "jwt": { "type": "string", "description": "JWT token for authentication" } }, "additionalProperties": false }, "VaultOidcAuth": { "type": "object", "required": ["method"], "properties": { "method": { "const": "oidc" }, "role": { "type": "string", "description": "OIDC auth role name" }, "port": { "type": "integer", "description": "Local port for OIDC callback" } }, "additionalProperties": false }, "VaultAuthConfig": { "description": "Authentication configuration for HashiCorp Vault", "oneOf": [ { "$ref": "#/definitions/VaultTokenAuth" }, { "$ref": "#/definitions/VaultAppRoleAuth" }, { "$ref": "#/definitions/VaultKubernetesAuth" }, { "$ref": "#/definitions/VaultJwtAuth" }, { "$ref": "#/definitions/VaultOidcAuth" } ] }, "VaultPluginConfig": { "type": "object", "description": "Configuration for the HashiCorp Vault plugin", "properties": { "address": { "type": "string", "description": "Vault server address. Defaults to VAULT_ADDR env var." }, "namespace": { "type": "string", "description": "Vault namespace. Defaults to VAULT_NAMESPACE env var." }, "auth": { "$ref": "#/definitions/VaultAuthConfig" } }, "additionalProperties": false }, "AutoDockerPluginConfig": { "type": "object", "description": "Configuration for the AutoDocker plugin", "properties": { "glob": { "type": "string", "description": "Glob pattern to find Dockerfiles. Defaults to '*/Dockerfile'." }, "ignore": { "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ], "description": "Patterns to ignore when searching for Dockerfiles." } }, "additionalProperties": false }, "DotEnvPluginConfig": { "type": "array", "description": "Array of .env file paths to load", "items": { "type": "string" } }, "EmbfilesPluginConfig": { "type": "object", "description": "Configuration for the Embfiles loader plugin", "properties": { "glob": { "oneOf": [ { "type": "string" }, { "type": "array", "items": { "type": "string" } } ], "description": "Glob pattern(s) to find Embfiles. Defaults to '*/Embfile.{yaml,yml}'." } }, "additionalProperties": false }, "PluginConfigItem": { "type": "object", "required": ["name"], "properties": { "name": { "$ref": "#/definitions/Identifier" }, "config": {} }, "additionalProperties": false, "allOf": [ { "if": { "properties": { "name": { "const": "vault" } }, "required": ["name"] }, "then": { "properties": { "config": { "$ref": "#/definitions/VaultPluginConfig" } } } }, { "if": { "properties": { "name": { "const": "autodocker" } }, "required": ["name"] }, "then": { "properties": { "config": { "$ref": "#/definitions/AutoDockerPluginConfig" } } } }, { "if": { "properties": { "name": { "const": "dotenv" } }, "required": ["name"] }, "then": { "properties": { "config": { "$ref": "#/definitions/DotEnvPluginConfig" } } } }, { "if": { "properties": { "name": { "const": "embfiles" } }, "required": ["name"] }, "then": { "properties": { "config": { "$ref": "#/definitions/EmbfilesPluginConfig" } } } } ] } } }