{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/gitpod-automations/latest.json",
  "title": "Automations File",
  "description": "WARN: Do not remove any field here, as it will break reading automation yaml files. We error if there are any\n unknown fields in the yaml (to ensure the yaml is correct), but would break if we removed any fields.\n This includes marking a field as \"reserved\" in the proto file, this will also break reading the yaml.",
  "x-lintel": {
    "source": "https://app.gitpod.io/jsonschema/v1/automations_file.jsonschema.json",
    "sourceSha256": "491d0b456bb5c76843cc7563473a4f8976472d26f3dcfab85c856df32a0a7154",
    "fileMatch": [
      "**/.gitpod/automations.json",
      "**/.gitpod/automations.yaml",
      "**/.gitpod/automations.yml",
      "**/.gitpod/automation.yaml"
    ],
    "parsers": [
      "json",
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "services": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[a-zA-Z0-9_-]{1,128}$",
        "type": "string"
      },
      "additionalProperties": {
        "$ref": "#/$defs/gitpod.v1.AutomationsFile.Service"
      }
    },
    "tasks": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[a-zA-Z0-9_-]{1,128}$",
        "type": "string"
      },
      "additionalProperties": {
        "$ref": "#/$defs/gitpod.v1.AutomationsFile.Task"
      }
    }
  },
  "$defs": {
    "gitpod.v1.AutomationsFile.Service": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "commands": {
          "$ref": "#/$defs/gitpod.v1.ServiceSpec.Commands"
        },
        "description": {
          "default": "",
          "type": "string"
        },
        "name": {
          "default": "",
          "minLength": 1,
          "type": "string"
        },
        "role": {
          "default": "",
          "enum": [
            "",
            "default",
            "editor",
            "ai-agent"
          ],
          "type": "string"
        },
        "runsOn": {
          "$ref": "#/$defs/gitpod.v1.RunsOn"
        },
        "triggeredBy": {
          "items": {
            "enum": [
              "manual",
              "postEnvironmentStart",
              "postDevcontainerStart"
            ],
            "type": "string"
          },
          "type": "array"
        }
      },
      "title": "Service",
      "patternProperties": {
        "^(runs_on)$": {
          "$ref": "#/$defs/gitpod.v1.RunsOn"
        },
        "^(triggered_by)$": {
          "items": {
            "enum": [
              "manual",
              "postEnvironmentStart",
              "postDevcontainerStart"
            ],
            "type": "string"
          },
          "type": "array"
        }
      }
    },
    "gitpod.v1.AutomationsFile.Task": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "command": {
          "default": "",
          "minLength": 1,
          "type": "string"
        },
        "dependsOn": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "default": "",
          "type": "string"
        },
        "name": {
          "default": "",
          "minLength": 1,
          "type": "string"
        },
        "runsOn": {
          "$ref": "#/$defs/gitpod.v1.RunsOn"
        },
        "triggeredBy": {
          "items": {
            "enum": [
              "manual",
              "postEnvironmentStart",
              "postDevcontainerStart",
              "prebuild"
            ],
            "type": "string"
          },
          "type": "array"
        }
      },
      "title": "Task",
      "patternProperties": {
        "^(depends_on)$": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "^(runs_on)$": {
          "$ref": "#/$defs/gitpod.v1.RunsOn"
        },
        "^(triggered_by)$": {
          "items": {
            "enum": [
              "manual",
              "postEnvironmentStart",
              "postDevcontainerStart",
              "prebuild"
            ],
            "type": "string"
          },
          "type": "array"
        }
      }
    },
    "gitpod.v1.RunsOn": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "docker": {
          "$ref": "#/$defs/gitpod.v1.RunsOn.Docker"
        },
        "machine": {
          "$ref": "#/$defs/gitpod.v1.RunsOn.Machine"
        }
      },
      "title": "Runs On",
      "additionalProperties": false
    },
    "gitpod.v1.RunsOn.Docker": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "environment": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "image": {
          "default": "",
          "minLength": 1,
          "type": "string"
        }
      },
      "title": "Docker",
      "additionalProperties": false
    },
    "gitpod.v1.RunsOn.Machine": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "description": "Machine runs the service/task directly on the VM/machine level.",
      "properties": {},
      "title": "Machine",
      "additionalProperties": false
    },
    "gitpod.v1.ServiceSpec.Commands": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "ready": {
          "default": "",
          "description": "ready is an optional command that is run repeatedly until it exits with a zero exit code.\n If set, the service will first go into a Starting phase, and then into a Running phase once the ready\n command exits with a zero exit code.",
          "type": "string"
        },
        "start": {
          "default": "",
          "description": "start is the command to start and run the service.\n If start exits, the service will transition to the following phase:\n - Stopped: if the exit code is 0\n - Failed: if the exit code is not 0\n If the stop command is not set, the start command will receive a SIGTERM signal when the service is\n requested to stop. If it does not exit within 2 minutes, it will receive a SIGKILL signal.",
          "minLength": 1,
          "type": "string"
        },
        "stop": {
          "default": "",
          "description": "stop is an optional command that runs when the service is requested to stop.\n If set, instead of sending a SIGTERM signal to the start command, the stop command will be run.\n Once the stop command exits, the start command will receive a SIGKILL signal.\n If the stop command exits with a non-zero exit code, the service will transition to the Failed phase.\n If the stop command does not exit within 2 minutes, a SIGKILL signal will be sent to both the start and\n stop commands.",
          "type": "string"
        }
      },
      "title": "Commands",
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
