{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://json.schemastore.org/codeship-services.json",
  "additionalProperties": {
    "$ref": "#/definitions/ExternalService"
  },
  "definitions": {
    "ExternalService": {
      "title": "CodeShip Pro Service",
      "description": "The definition of a service in a CodeShip Pro build, which can have steps run on it or have other services depend on it",
      "properties": {
        "add_docker": {
          "description": "If true, the docker socket will be exposed in this service.",
          "default": false,
          "type": "boolean"
        },
        "build": {
          "description": "How to build the image for this service. Mutually exclusive with 'image'. Can either be just a path containing a Dockerfile, or a build definition.",
          "oneOf": [
            {
              "$ref": "#/definitions/externalBuild"
            },
            {
              "type": "string"
            }
          ]
        },
        "cached": {
          "description": "Whether the image for this service should be rebuilt from scratch for each run, or if the latest build of the service's image from the configured cache branch (defaulting to 'master') should be used.",
          "default": false,
          "type": "boolean"
        },
        "cap_add": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "cap_drop": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "command": {
          "description": "The command to run when launching the service, overriding the 'CMD' in the image. Optional.",
          "type": "string"
        },
        "cpuset": {
          "type": "string"
        },
        "cpu_shares": {
          "type": "integer"
        },
        "default_cache_branch": {
          "description": "The branch to use for caching. Defaults to 'master'",
          "type": "string"
        },
        "dns": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "dns_search": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "dockercfg_service": {
          "description": "The name of another defined service that provides the Docker configuration for building and running this service. Optional.",
          "type": "string"
        },
        "dockerfile": {
          "description": "A specific Dockerfile to use, rather than the one in the build context",
          "type": "string"
        },
        "domainname": {
          "type": "string"
        },
        "encrypted_dockercfg_path": {
          "description": "The location of a Docker configuration file encrypted by Jet to be used with building and running this service. Optional.",
          "type": "string"
        },
        "encrypted_env_file": {
          "description": "The location of one or more files, encrypted with Jet, containing environment variables to be made available to this service and steps running on it. Optional.",
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "string"
            }
          ]
        },
        "encrypted_environment": {
          "description": "A list of encrypted key/value pairs to be used in the environment for this service and steps running on it. Optional.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "entrypoint": {
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "string"
            }
          ]
        },
        "env_file": {
          "description": "The location of one or more files containing environment variables to be made available to this service and steps running on it. Optional.",
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "string"
            }
          ]
        },
        "environment": {
          "description": "Either a map of key/value pairs or a list of 'KEY=VALUE' pairs to be used in the environment for this service and steps running on it. Optional.",
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "object",
              "additionalProperties": true
            }
          ]
        },
        "expose": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "extra_hosts": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "hostname": {
          "type": "string"
        },
        "image": {
          "description": "A pre-existing image to use for this service. Mutually exclusive with 'build'",
          "type": "string"
        },
        "links": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "depends_on": {
          "description": "A list of other services that this service depends on. Use this instead of 'links'",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "mem_limit": {
          "type": "string"
        },
        "privileged": {
          "type": "boolean"
        },
        "ports": {
          "description": "A list of ports that should be exposed to other services. The ports should be defined like '9999', as strings",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "read_only": {
          "type": "boolean"
        },
        "restart": {
          "type": "string"
        },
        "security_opt": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "user": {
          "type": "string"
        },
        "volumes": {
          "description": "A list of origin/destination pairs of directories or files relative to the build context and where they should be mounted in the service. Optional.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "volumes_from": {
          "description": "A list of other services which should have their defined volumes mounted into this service as well. Optional.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "working_dir": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "oneOf": [
        {
          "required": ["build"]
        },
        {
          "required": ["image"]
        }
      ]
    },
    "externalBuild": {
      "title": "Image Build",
      "description": "Configuration of how to build the image for this service",
      "properties": {
        "path": {
          "description": "DEPRECATED: Use 'context' instead.",
          "type": "string"
        },
        "dockerfile_path": {
          "description": "DEPRECATED: Use 'dockerfile' instead",
          "type": "string"
        },
        "image": {
          "description": "The output image name for this image. Optional.",
          "type": "string"
        },
        "context": {
          "description": "The directory used as the Docker build context. Defaults to the same directory as the codeship-services.yml file",
          "type": "string"
        },
        "dockerfile": {
          "description": "A specific Dockerfile to use rather than the 'Dockerfile' present in the build context. Optional.",
          "type": "string"
        },
        "configure": {
          "$ref": "#/definitions/externalBuildConfigure"
        },
        "args": {
          "description": "Build args to pass to Docker. Optional.",
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "object",
              "additionalProperties": true
            }
          ]
        },
        "encrypted_args_file": {
          "description": "One or more files, encrypted with Jet, to have their contents decrypted and passed to Docker as build args. Optional.",
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "string"
            }
          ]
        },
        "encrypted_args": {
          "description": "A list of encrypted key/value pairs to be used as build args to Docker. Optional.",
          "oneOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "string"
            }
          ]
        }
      },
      "additionalProperties": false,
      "type": "object"
    },
    "externalBuildConfigure": {
      "properties": {
        "service": {
          "type": "string"
        },
        "command": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object"
    }
  },
  "description": "codeship-services.yml is where you configure each service you need to run your CI/CD builds with CodeShip.",
  "title": "CodeShip Pro services configuration",
  "type": "object"
}
