{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/hammerkit/latest.json",
  "title": "JSON Schema for hammerkit's build file",
  "description": "Build tool with support for containerization\n<https://no0dles.gitbook.io/hammerkit/build-file>",
  "x-lintel": {
    "source": "https://www.schemastore.org/hammerkit.json",
    "sourceSha256": "19aac214d513cf6cf19385148826978873cb226bb0b111274cec1b9bc836520c",
    "fileMatch": [
      ".hammerkit.yaml",
      ".hammerkit.yml",
      "*.hammerkit.yaml",
      "*.hammerkit.yml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "envs": {
      "$ref": "#/$defs/buildFileEnvs"
    },
    "tasks": {
      "$ref": "#/$defs/buildFileTasks"
    },
    "services": {
      "$ref": "#/$defs/buildFileServices"
    },
    "includes": {
      "$ref": "#/$defs/buildFileIncludes"
    },
    "references": {
      "$ref": "#/$defs/buildFileReferences"
    }
  },
  "$defs": {
    "buildFileEnvs": {
      "title": "environment variables",
      "description": "Environment values for the current build task\n<https://no0dles.gitbook.io/hammerkit/build-file/environment-variables>",
      "type": "object",
      "additionalProperties": {
        "description": "environment variable",
        "type": "string"
      }
    },
    "buildFileTasks": {
      "title": "tasks",
      "description": "Task for the current build file\n<https://no0dles.gitbook.io/hammerkit/task>",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/task"
      }
    },
    "buildFileServices": {
      "title": "services",
      "description": "Services for the current build file\n<https://no0dles.gitbook.io/hammerkit/service>",
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/service"
      }
    },
    "buildFileIncludes": {
      "title": "includes",
      "description": "Includes to other build files\n<https://no0dles.gitbook.io/hammerkit/build-file/includes>",
      "type": "object",
      "additionalProperties": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/hammerkit/_shared/latest--base.json#/$defs/path"
      }
    },
    "buildFileReferences": {
      "title": "references",
      "description": "References to other build files\n<https://no0dles.gitbook.io/hammerkit/build-file/references>",
      "type": "object",
      "additionalProperties": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/hammerkit/_shared/latest--base.json#/$defs/path"
      }
    },
    "task": {
      "title": "task",
      "description": "Task for the current build file\n<https://no0dles.gitbook.io/hammerkit/task>",
      "anyOf": [
        {
          "$ref": "#/$defs/containerTask"
        },
        {
          "$ref": "#/$defs/localTask"
        }
      ]
    },
    "localTask": {
      "title": "local task",
      "description": "Task that gets executed in the local shell in the current directory",
      "type": "object",
      "properties": {
        "description": {
          "$ref": "#/$defs/taskCommand"
        },
        "labels": {
          "$ref": "#/$defs/taskLabels"
        },
        "extend": {
          "$ref": "#/$defs/taskExtend"
        },
        "cache": {
          "$ref": "#/$defs/taskCache"
        },
        "continuous": {
          "$ref": "#/$defs/taskContinuous"
        },
        "envs": {
          "$ref": "#/$defs/taskEnvs"
        },
        "needs": {
          "$ref": "#/$defs/taskNeeds"
        },
        "deps": {
          "$ref": "#/$defs/taskDeps"
        },
        "src": {
          "$ref": "#/$defs/taskSrc"
        },
        "generates": {
          "$ref": "#/$defs/taskGenerates"
        },
        "cmds": {
          "description": "Commands for the current task",
          "type": "array",
          "items": {
            "$ref": "#/$defs/taskCommand"
          }
        }
      },
      "required": [
        "cmds"
      ],
      "additionalProperties": false
    },
    "containerTask": {
      "title": "container task",
      "description": "Container task for the current build file\n<https://no0dles.gitbook.io/hammerkit/task/container>",
      "type": "object",
      "required": [
        "image",
        "cmds"
      ],
      "properties": {
        "description": {
          "$ref": "#/$defs/taskCommand"
        },
        "extend": {
          "$ref": "#/$defs/taskExtend"
        },
        "labels": {
          "$ref": "#/$defs/taskLabels"
        },
        "cache": {
          "$ref": "#/$defs/taskCache"
        },
        "continuous": {
          "$ref": "#/$defs/taskContinuous"
        },
        "envs": {
          "$ref": "#/$defs/taskEnvs"
        },
        "needs": {
          "$ref": "#/$defs/taskNeeds"
        },
        "deps": {
          "$ref": "#/$defs/taskDeps"
        },
        "src": {
          "$ref": "#/$defs/taskSrc"
        },
        "generates": {
          "$ref": "#/$defs/taskGenerates"
        },
        "cmds": {
          "description": "Commands for the current task",
          "type": "array",
          "items": {
            "$ref": "#/$defs/taskCommand"
          }
        },
        "shell": {
          "title": "task shell",
          "description": "Define which shell is used to execute the commands",
          "type": "string"
        },
        "image": {
          "title": "task image",
          "description": "Container image for the current task to run commands in",
          "type": "string"
        },
        "ports": {
          "description": "A list of ports that get exposed on the host from the container <localPort>:<targetPort>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<localPort>:<targetPort>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "mounts": {
          "description": "File paths that get mounted into the container\n<https://no0dles.gitbook.io/hammerkit/task/container#adding-mounts>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        }
      },
      "additionalProperties": false
    },
    "taskCommand": {
      "anyOf": [
        {
          "title": "command",
          "description": "Command to be executed for the current task",
          "type": "string"
        },
        {
          "title": "task command with path extension",
          "description": "Command to be executed in sub directory for the current task",
          "type": "object",
          "properties": {
            "cmd": {
              "title": "command",
              "description": "Command to be executed for the task",
              "type": "string"
            },
            "path": {
              "$ref": "https://catalog.lintel.tools/schemas/schemastore/hammerkit/_shared/latest--base.json#/$defs/path",
              "title": "command path",
              "description": "Path below build file path"
            }
          },
          "required": [
            "cmd"
          ],
          "additionalProperties": false
        }
      ]
    },
    "taskDescription": {
      "description": "Description for the current task",
      "type": "string"
    },
    "taskExtend": {
      "description": "Extension task as a base template\n<https://no0dles.gitbook.io/hammerkit/task/extending>",
      "type": "string"
    },
    "taskCache": {
      "description": "compare type for detecting changes in source files\n<https://no0dles.gitbook.io/hammerkit/task/caching>",
      "type": "string",
      "enum": [
        "checksum",
        "modify-date",
        "none"
      ]
    },
    "taskContinuous": {
      "description": "The task runs continuous and does not end without cancellation\n<https://no0dles.gitbook.io/hammerkit/task/watching#continuous-tasks>",
      "type": "boolean"
    },
    "taskLabels": {
      "title": "label options",
      "description": "A map of label values for the current task\n<https://no0dles.gitbook.io/hammerkit/labels>",
      "type": "object",
      "additionalProperties": {
        "description": "label value",
        "type": "string"
      }
    },
    "taskEnvs": {
      "title": "task environment variables",
      "description": "Environment values for the current build file\n<https://no0dles.gitbook.io/hammerkit/build-file/environment-variables>",
      "type": "object",
      "additionalProperties": {
        "description": "environment value",
        "type": "string"
      }
    },
    "taskNeeds": {
      "description": "Service needs that need to get ready before the current task\n<https://no0dles.gitbook.io/hammerkit/task/needs>",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "taskDeps": {
      "description": "Task dependencies that get executed before the current task\n<https://no0dles.gitbook.io/hammerkit/task/dependencies>",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string"
      }
    },
    "taskSrc": {
      "description": "Source files and folders for the current task\n<https://no0dles.gitbook.io/hammerkit/task#source>",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/hammerkit/_shared/latest--base.json#/$defs/path"
      }
    },
    "taskGenerates": {
      "description": "Generated files and folders for the current task\n\n<https://no0dles.gitbook.io/hammerkit/task#generate>",
      "type": "array",
      "uniqueItems": true,
      "items": {
        "$ref": "https://catalog.lintel.tools/schemas/schemastore/hammerkit/_shared/latest--base.json#/$defs/path"
      }
    },
    "service": {
      "title": "service",
      "description": "A daemon in the background",
      "anyOf": [
        {
          "$ref": "#/$defs/containerService"
        },
        {
          "$ref": "#/$defs/kubernetesService"
        }
      ]
    },
    "kubernetesService": {
      "title": "kubernetes service",
      "description": "Kubernetes service for the current build file\n<https://no0dles.gitbook.io/hammerkit/service/kubernetes>",
      "type": "object",
      "required": [
        "context",
        "selector",
        "ports"
      ],
      "properties": {
        "kubeconfig": {
          "description": "Kube config for the current service\n<https://no0dles.gitbook.io/hammerkit/service/kubernetes#config>",
          "type": "string"
        },
        "context": {
          "description": "Kubernetes context for the current service\n<https://no0dles.gitbook.io/hammerkit/service/kubernetes#config>",
          "type": "string"
        },
        "ports": {
          "description": "A list of ports that get exposed on the host from the service <localPort>:<targetPort>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<localPort>:<targetPort>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "selector": {
          "title": "service selector",
          "description": "Selector to specify which resource gets forwarded to\n<https://no0dles.gitbook.io/hammerkit/service/kubernetes>",
          "type": "object",
          "required": [
            "type",
            "name"
          ],
          "properties": {
            "type": {
              "description": "resource type for the current service",
              "type": "string",
              "enum": [
                "deployment",
                "service",
                "pod"
              ]
            },
            "name": {
              "description": "resource name for the kubernetes resource",
              "type": "string"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "containerService": {
      "title": "container service",
      "description": "Container service for the current build file\n<https://no0dles.gitbook.io/hammerkit/service/kubernetes>",
      "type": "object",
      "required": [
        "image"
      ],
      "properties": {
        "labels": {
          "title": "label options",
          "description": "A map of label values for the current service\n<https://no0dles.gitbook.io/hammerkit/labels>",
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "envs": {
          "title": "service environment variables",
          "description": "Environment values for the current service\n<https://no0dles.gitbook.io/hammerkit/build-file/environment-variables>",
          "type": "object",
          "additionalProperties": {
            "description": "environment value",
            "type": "string"
          }
        },
        "healthcheck": {
          "title": "service healthcheck",
          "description": "Check to detect if the service is started and ready\n<https://no0dles.gitbook.io/hammerkit/service/container#healthcheck>",
          "type": "object",
          "required": [
            "cmd"
          ],
          "properties": {
            "cmd": {
              "description": "task to check if the service is healthy",
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "image": {
          "description": "Container image for the current service to run commands in",
          "type": "string"
        },
        "ports": {
          "description": "A list of ports that get exposed on the host from the container <localPort>:<targetPort>\n<https://no0dles.gitbook.io/hammerkit/service/container#mounts>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<localPort>:<targetPort>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "volumes": {
          "description": "A list of volumes that get attached to the container <name>:<containerPath>\n<https://no0dles.gitbook.io/hammerkit/service/container#mounts>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "description": "<name>:<containerPath>",
            "type": "string",
            "pattern": "\\d+:\\d+"
          }
        },
        "mounts": {
          "description": "File paths that get mounted into the container <localPath>:<containerPath>\n<https://no0dles.gitbook.io/hammerkit/service/container#mounts>",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "description": "<localPath>:<containerPath>",
            "pattern": "\\d+:\\d+"
          }
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "$comment": "https://no0dles.gitbook.io"
}
