{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-firebase/json-schema/google-firebase-build-schema.json",
  "title": "Build",
  "description": "A single build for a backend, at a specific point codebase reference tag and point in time. Encapsulates several resources, including an Artifact Registry container image, a Cloud Build invocation that built the image, and the Cloud Run revision that uses that image.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-firebase-firebaseapphosting-projects-api-openapi.yml#/components/schemas/Build",
  "type": "object",
  "properties": {
    "reconciling": {
      "description": "Output only. A field that, if true, indicates that the build has an ongoing LRO.",
      "readOnly": true,
      "type": "boolean"
    },
    "name": {
      "description": "Identifier. The resource name of the build. Format: `projects/{project}/locations/{locationId}/backends/{backendId}/builds/{buildId}`.",
      "type": "string"
    },
    "errors": {
      "type": "array",
      "description": "Output only. A list of all errors that occurred during an App Hosting build.",
      "items": {
        "$ref": "#/$defs/Error"
      },
      "readOnly": true
    },
    "buildLogsUri": {
      "type": "string",
      "description": "Output only. The location of the [Cloud Build logs](https://cloud.google.com/build/docs/view-build-results) for the build process.",
      "readOnly": true
    },
    "source": {
      "$ref": "#/$defs/BuildSource",
      "description": "Required. Immutable. The source for the build."
    },
    "labels": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Optional. Unstructured key value map that can be used to organize and categorize objects."
    },
    "updateTime": {
      "description": "Output only. Time at which the build was last updated.",
      "readOnly": true,
      "format": "google-datetime",
      "type": "string"
    },
    "image": {
      "type": "string",
      "description": "Output only. The Artifact Registry [container image](https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.dockerImages) URI, used by the Cloud Run [`revision`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services.revisions) for this build.",
      "readOnly": true
    },
    "displayName": {
      "description": "Optional. Human-readable name. 63 character limit.",
      "type": "string"
    },
    "createTime": {
      "type": "string",
      "format": "google-datetime",
      "readOnly": true,
      "description": "Output only. Time at which the build was created."
    },
    "etag": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. Server-computed checksum based on other values; may be sent on update or delete to ensure operation is done on expected resource."
    },
    "environment": {
      "description": "Output only. The environment name of the backend when this build was created.",
      "type": "string",
      "readOnly": true
    },
    "deleteTime": {
      "readOnly": true,
      "format": "google-datetime",
      "description": "Output only. Time at which the build was deleted.",
      "type": "string"
    },
    "config": {
      "$ref": "#/$defs/Config",
      "description": "Optional. Additional configuration of the service."
    },
    "uid": {
      "description": "Output only. System-assigned, unique identifier.",
      "type": "string",
      "readOnly": true
    },
    "annotations": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "description": "Optional. Unstructured key value map that may be set by external tools to store and arbitrary metadata. They are not queryable and should be preserved when modifying objects."
    },
    "state": {
      "readOnly": true,
      "enum": [
        "STATE_UNSPECIFIED",
        "BUILDING",
        "BUILT",
        "DEPLOYING",
        "READY",
        "FAILED",
        "SKIPPED",
        "EXPIRED"
      ],
      "description": "Output only. The state of the build.",
      "type": "string"
    }
  },
  "$defs": {
    "ArchiveSource": {
      "description": "The URI of an storage archive or a signed URL to use as the build source.",
      "type": "object",
      "properties": {
        "userStorageUri": {
          "description": "URI to an archive in Cloud Storage. The object must be a zipped (.zip) or gzipped archive file (.tar.gz) containing source to deploy.",
          "type": "string"
        },
        "externalSignedUri": {
          "description": "Signed URL to an archive in a storage bucket.",
          "type": "string"
        },
        "author": {
          "$ref": "#/$defs/SourceUserMetadata",
          "description": "Optional. Deprecated: Not used. The author contained in the metadata of a version control change."
        },
        "rootDirectory": {
          "description": "Optional. The directory relative to the root of the archive to use as the root for the deployed web app. Defaults to use the root of the repository if not provided. If deploying a [monorepo](https://firebase.google.com/docs/app-hosting/monorepos), this should be the directory that contains the `package.json` or `apphosting.yaml` file.",
          "type": "string"
        },
        "description": {
          "description": "Optional. An optional message that describes the uploaded version of the source code.",
          "type": "string"
        }
      }
    },
    "BuildSource": {
      "type": "object",
      "description": "The source for the build.",
      "properties": {
        "container": {
          "$ref": "#/$defs/ContainerSource",
          "description": "An Artifact Registry container image source."
        },
        "archive": {
          "$ref": "#/$defs/ArchiveSource",
          "description": "An archive source."
        },
        "codebase": {
          "$ref": "#/$defs/CodebaseSource",
          "description": "A codebase source."
        }
      }
    },
    "CodebaseSource": {
      "properties": {
        "commitTime": {
          "type": "string",
          "description": "Output only. The time the change was made.",
          "readOnly": true,
          "format": "google-datetime"
        },
        "repository": {
          "readOnly": true,
          "description": "Output only. The resource name for the Developer Connect [`gitRepositoryLink`](https://cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks) used for this build, in the format: `projects/{project}/locations/{location}/connections/{connection}/gitRepositoryLinks/{repositoryLink}`",
          "type": "string"
        },
        "commitMessage": {
          "description": "Output only. The message of a codebase change.",
          "readOnly": true,
          "type": "string"
        },
        "displayName": {
          "type": "string",
          "description": "Output only. The human-friendly name to use for this Codebase when displaying a build. We use the first eight characters of the SHA-1 hash for GitHub.com.",
          "readOnly": true
        },
        "author": {
          "$ref": "#/$defs/UserMetadata",
          "description": "Output only. The author contained in the metadata of a version control change."
        },
        "uri": {
          "readOnly": true,
          "description": "Output only. A URI linking to the codebase on an hosting provider's website. May not be valid if the commit has been rebased or force-pushed out of existence in the linked repository.",
          "type": "string"
        },
        "branch": {
          "description": "The branch in the codebase to build from, using the latest commit.",
          "type": "string"
        },
        "commit": {
          "description": "The commit in the codebase to build from.",
          "type": "string"
        },
        "hash": {
          "description": "Output only. The full SHA-1 hash of a Git commit, if available.",
          "readOnly": true,
          "type": "string"
        }
      },
      "type": "object",
      "description": "A codebase source, representing the state of the codebase that the build will be created at."
    },
    "Config": {
      "type": "object",
      "description": "Additional configuration of the backend for this build.",
      "properties": {
        "effectiveEnv": {
          "readOnly": true,
          "type": "array",
          "items": {
            "$ref": "#/$defs/EnvironmentVariable"
          },
          "description": "Output only. [OUTPUT_ONLY] This field represents all environment variables employed during both the build and runtime. This list reflects the result of merging variables from all sources (Backend.override_env, Build.Config.env, YAML, defaults, system). Each variable includes its `origin`"
        },
        "env": {
          "description": "Optional. Supplied environment variables for a specific build. Provided at Build creation time and immutable afterwards. This field is only applicable for Builds using a build image - (e.g., ContainerSource or ArchiveSource with locally_built_source) Attempts to set this for other build types will result in an error",
          "items": {
            "$ref": "#/$defs/EnvironmentVariable"
          },
          "type": "array"
        },
        "runConfig": {
          "$ref": "#/$defs/RunConfig",
          "description": "Optional. Additional configuration of the Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service)."
        }
      }
    },
    "ContainerSource": {
      "description": "The URI of an Artifact Registry [container image](https://cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.dockerImages) to use as the build source.",
      "properties": {
        "image": {
          "type": "string",
          "description": "Required. A URI representing a container for the backend to use."
        }
      },
      "type": "object"
    },
    "EnvironmentVariable": {
      "description": "Environment variables for this build.",
      "properties": {
        "variable": {
          "description": "Required. The name of the environment variable. The environment variables reserved by [Cloud Run](https://docs.cloud.google.com/run/docs/configuring/services/environment-variables#reserved) should not be set. Additionally, variable names cannot start with \"X_FIREBASE_\".",
          "type": "string"
        },
        "value": {
          "description": "A plaintext value. This value is encrypted at rest, but all project readers can view the value when reading your backend configuration.",
          "type": "string"
        },
        "origin": {
          "description": "Output only. The high-level origin category of the environment variable.",
          "readOnly": true,
          "type": "string",
          "enum": [
            "ORIGIN_UNSPECIFIED",
            "BACKEND_OVERRIDES",
            "BUILD_CONFIG",
            "APPHOSTING_YAML",
            "FIREBASE_SYSTEM"
          ]
        },
        "originFileName": {
          "type": "string",
          "description": "Output only. Specific detail about the source. For APPHOSTING_YAML origins, this will contain the exact filename, such as \"apphosting.yaml\" or \"apphosting.staging.yaml\".",
          "readOnly": true
        },
        "secret": {
          "description": "A fully qualified secret version. The value of the secret will be accessed once while building the application and once per cold start of the container at runtime. The service account used by Cloud Build and by Cloud Run must each have the `secretmanager.versions.access` permission on the secret.",
          "type": "string"
        },
        "availability": {
          "type": "array",
          "description": "Optional. Where this variable should be made available. If left unspecified, will be available in both BUILD and BACKEND.",
          "items": {
            "enum": [
              "AVAILABILITY_UNSPECIFIED",
              "BUILD",
              "RUNTIME"
            ],
            "type": "string"
          }
        }
      },
      "type": "object"
    },
    "Error": {
      "description": "The container for the rpc status and source for any errors found during the build process.",
      "type": "object",
      "properties": {
        "errorSource": {
          "description": "Output only. The source of the error for the build, if in a `FAILED` state.",
          "readOnly": true,
          "enum": [
            "ERROR_SOURCE_UNSPECIFIED",
            "CLOUD_BUILD",
            "CLOUD_RUN"
          ],
          "type": "string"
        },
        "cloudResource": {
          "type": "string",
          "readOnly": true,
          "description": "Output only. Resource link"
        },
        "error": {
          "$ref": "#/$defs/Status",
          "description": "Output only. A status and (human readable) error message for the build, if in a `FAILED` state."
        }
      }
    },
    "RunConfig": {
      "properties": {
        "cpu": {
          "format": "float",
          "type": "number",
          "description": "Optional. Number of CPUs used for each serving instance. By default, cpu defaults to the Cloud Run's default of 1.0. CPU can be set to value 1, 2, 4, 6, or 8 CPUs, and for less than 1 CPU, a value from 0.08 to less than 1.00, in increments of 0.01. If you set a value of less than 1 CPU, you must set concurrency to 1, and CPU will only be allocated during request processing. Increasing CPUs limit may require increase in memory limits: - 4 CPUs: at least 2 GiB - 6 CPUs: at least 4 GiB - 8 CPUs: at least 4 GiB"
        },
        "memoryMib": {
          "description": "Optional. Amount of memory allocated for each serving instance in MiB. By default, memory defaults to the Cloud Run's default where each instance is allocated 512 MiB of memory. Memory can be set to any integer value between 128 to 32768. Increasing memory limit may require increase in CPUs limits: - Over 4 GiB: at least 2 CPUs - Over 8 GiB: at least 4 CPUs - Over 16 GiB: at least 6 CPUs - Over 24 GiB: at least 8 CPUs",
          "type": "integer",
          "format": "int32"
        },
        "maxInstances": {
          "format": "int32",
          "description": "Optional. Number of Cloud Run instances to maintain at maximum for each revision. By default, each Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service) scales out to Cloud Run's default of a maximum of 100 instances. The maximum max_instances limit is based on your quota. See https://cloud.google.com/run/docs/configuring/max-instances#limits.",
          "type": "integer"
        },
        "minInstances": {
          "type": "integer",
          "description": "Optional. Number of Cloud Run instances to maintain at minimum for each Cloud Run Service. By default, there are no minimum. Even if the service splits traffic across multiple revisions, the total number of instances for a service will be capped at this value.",
          "format": "int32"
        },
        "concurrency": {
          "format": "int32",
          "description": "Optional. Maximum number of requests that each Cloud Run instance can receive. By default, each instance can receive Cloud Run's default of up to 80 requests at the same time. Concurrency can be set to any integer value up to 1000.",
          "type": "integer"
        }
      },
      "type": "object",
      "description": "Configuration applied to the Cloud Run [`service`](https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#resource:-service)."
    },
    "SourceUserMetadata": {
      "type": "object",
      "description": "Deprecated: Not used. Metadata for the user who started the build.",
      "properties": {
        "displayName": {
          "type": "string",
          "description": "Output only. Deprecated: Not used. The user-chosen displayname. May be empty.",
          "readOnly": true,
          "deprecated": true
        },
        "email": {
          "description": "Output only. Deprecated: Not used. The account email linked to the EUC that created the build. May be a service account or other robot account.",
          "readOnly": true,
          "type": "string",
          "deprecated": true
        },
        "imageUri": {
          "readOnly": true,
          "description": "Output only. Deprecated: Not used. The URI of a profile photo associated with the user who created the build.",
          "type": "string",
          "deprecated": true
        }
      },
      "deprecated": true
    },
    "Status": {
      "properties": {
        "message": {
          "description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.",
          "type": "string"
        },
        "code": {
          "type": "integer",
          "description": "The status code, which should be an enum value of google.rpc.Code.",
          "format": "int32"
        },
        "details": {
          "type": "array",
          "description": "A list of messages that carry the error details. There is a common set of message types for APIs to use.",
          "items": {
            "additionalProperties": {
              "description": "Properties of the object. Contains field @type with type URL."
            },
            "type": "object"
          }
        }
      },
      "type": "object",
      "description": "The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors)."
    },
    "UserMetadata": {
      "properties": {
        "displayName": {
          "readOnly": true,
          "type": "string",
          "description": "Output only. The 'name' field in a Git user's git.config. Required by Git."
        },
        "email": {
          "description": "Output only. The 'email' field in a Git user's git.config, if available.",
          "type": "string",
          "readOnly": true
        },
        "imageUri": {
          "description": "Output only. The URI of an image file associated with the user's account in an external source control provider, if available.",
          "type": "string",
          "readOnly": true
        }
      },
      "type": "object",
      "description": "Version control metadata for a user associated with a resolved codebase. Currently assumes a Git user."
    }
  }
}