public BuildConfig.Types.DockerRegistry DockerRegistry { get; set; }
Docker Registry to use for this deployment. This configuration is only
applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
Registry.
If unspecified, it defaults to ARTIFACT_REGISTRY.
If docker_repository field is specified, this field should either be left
unspecified or set to ARTIFACT_REGISTRY.
Repository in Artifact Registry to which the function docker image will be
pushed after it is built by Cloud Build. If specified by user, it is
created and managed by user with a customer managed encryption key.
Otherwise, GCF will create and use a repository named 'gcf-artifacts'
for every deployed region.
It must match the pattern
projects/{project}/locations/{location}/repositories/{repository}.
Cross-project repositories are not supported.
Cross-location repositories are not supported.
Repository format must be 'DOCKER'.
The name of the function (as defined in source code) that will be
executed. Defaults to the resource name suffix, if not specified. For
backward compatibility, if function with given name is not found, then the
system will try to use function named "function".
For Node.js this is name of a function exported by the module specified
in source_location.
The runtime in which to run the function. Required when deploying a new
function, optional when updating an existing function. For a complete
list of possible choices, see the
gcloud command
reference.
Name of the Cloud Build Custom Worker Pool that should be used to build the
function. The format of this field is
projects/{project}/locations/{region}/workerPools/{workerPool} where
{project} and {region} are the project id and region respectively where the
worker pool is defined and {workerPool} is the short name of the worker
pool.
If the project id is not the same as the function, then the Cloud
Functions Service Agent
(service-<project_number>@gcf-admin-robot.iam.gserviceaccount.com) must be
granted the role Cloud Build Custom Workers Builder
(roles/cloudbuild.customworkers.builder) in the project.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[[["\u003cp\u003eThis documentation covers the \u003ccode\u003eBuildConfig\u003c/code\u003e class within the Google Cloud Functions v2 API, detailing its role in the container build process for functions.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBuildConfig\u003c/code\u003e describes the build configuration for a function, including the source, runtime, and build environment, and it can manage updates through AutomaticUpdatePolicy and OnDeployUpdatePolicy.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eBuildConfig\u003c/code\u003e is 1.7.0, with documentation available for previous versions including 1.6.0, 1.5.0, 1.4.0, 1.3.0, 1.2.0, 1.1.0, and 1.0.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBuildConfig\u003c/code\u003e class includes properties like \u003ccode\u003eDockerRepository\u003c/code\u003e, \u003ccode\u003eEntryPoint\u003c/code\u003e, \u003ccode\u003eRuntime\u003c/code\u003e, \u003ccode\u003eServiceAccount\u003c/code\u003e, and \u003ccode\u003eSource\u003c/code\u003e, which define various aspects of how the function is built and executed.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBuildConfig\u003c/code\u003e allows users to specify build-time environment variables, and to designate the use of specific Cloud Build Custom Worker Pools for building the function.\u003c/p\u003e\n"]]],[],null,["# Cloud Functions v2 API - Class BuildConfig (1.7.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.7.0 (latest)](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildConfig)\n- [1.6.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.6.0/Google.Cloud.Functions.V2.BuildConfig)\n- [1.5.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.5.0/Google.Cloud.Functions.V2.BuildConfig)\n- [1.4.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.4.0/Google.Cloud.Functions.V2.BuildConfig)\n- [1.3.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.3.0/Google.Cloud.Functions.V2.BuildConfig)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.2.0/Google.Cloud.Functions.V2.BuildConfig)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.1.0/Google.Cloud.Functions.V2.BuildConfig)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.Functions.V2/1.0.0/Google.Cloud.Functions.V2.BuildConfig) \n\n public sealed class BuildConfig : IMessage\u003cBuildConfig\u003e, IEquatable\u003cBuildConfig\u003e, IDeepCloneable\u003cBuildConfig\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Cloud Functions v2 API class BuildConfig.\n\nDescribes the Build step of the function that builds a container from the\ngiven source. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e BuildConfig \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[BuildConfig](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildConfig), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[BuildConfig](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildConfig), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[BuildConfig](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildConfig), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Functions.V2](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2)\n\nAssembly\n--------\n\nGoogle.Cloud.Functions.V2.dll\n\nConstructors\n------------\n\n### BuildConfig()\n\n public BuildConfig()\n\n### BuildConfig(BuildConfig)\n\n public BuildConfig(BuildConfig other)\n\nProperties\n----------\n\n### AutomaticUpdatePolicy\n\n public AutomaticUpdatePolicy AutomaticUpdatePolicy { get; set; }\n\n### Build\n\n public string Build { get; set; }\n\nOutput only. The Cloud Build name of the latest successful deployment of\nthe function.\n\n### BuildAsBuildName\n\n public BuildName BuildAsBuildName { get; set; }\n\n[BuildName](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildName)-typed view over the [Build](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildConfig#Google_Cloud_Functions_V2_BuildConfig_Build) resource name property.\n\n### DockerRegistry\n\n public BuildConfig.Types.DockerRegistry DockerRegistry { get; set; }\n\nDocker Registry to use for this deployment. This configuration is only\napplicable to 1st Gen functions, 2nd Gen functions can only use Artifact\nRegistry.\n\nIf unspecified, it defaults to `ARTIFACT_REGISTRY`.\nIf `docker_repository` field is specified, this field should either be left\nunspecified or set to `ARTIFACT_REGISTRY`.\n\n### DockerRepository\n\n public string DockerRepository { get; set; }\n\nRepository in Artifact Registry to which the function docker image will be\npushed after it is built by Cloud Build. If specified by user, it is\ncreated and managed by user with a customer managed encryption key.\nOtherwise, GCF will create and use a repository named 'gcf-artifacts'\nfor every deployed region.\n\nIt must match the pattern\n`projects/{project}/locations/{location}/repositories/{repository}`.\n\nCross-project repositories are not supported.\nCross-location repositories are not supported.\nRepository format must be 'DOCKER'.\n\n### DockerRepositoryAsRepositoryName\n\n public RepositoryName DockerRepositoryAsRepositoryName { get; set; }\n\n[RepositoryName](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.RepositoryName)-typed view over the [DockerRepository](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildConfig#Google_Cloud_Functions_V2_BuildConfig_DockerRepository) resource name property.\n\n### EntryPoint\n\n public string EntryPoint { get; set; }\n\nThe name of the function (as defined in source code) that will be\nexecuted. Defaults to the resource name suffix, if not specified. For\nbackward compatibility, if function with given name is not found, then the\nsystem will try to use function named \"function\".\nFor Node.js this is name of a function exported by the module specified\nin `source_location`.\n\n### EnvironmentVariables\n\n public MapField\u003cstring, string\u003e EnvironmentVariables { get; }\n\nUser-provided build-time environment variables for the function\n\n### OnDeployUpdatePolicy\n\n public OnDeployUpdatePolicy OnDeployUpdatePolicy { get; set; }\n\n### Runtime\n\n public string Runtime { get; set; }\n\nThe runtime in which to run the function. Required when deploying a new\nfunction, optional when updating an existing function. For a complete\nlist of possible choices, see the\n[`gcloud` command\nreference](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).\n\n### RuntimeUpdatePolicyCase\n\n public BuildConfig.RuntimeUpdatePolicyOneofCase RuntimeUpdatePolicyCase { get; }\n\n### ServiceAccount\n\n public string ServiceAccount { get; set; }\n\nService account to be used for building the container. The format of this\nfield is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.\n\n### Source\n\n public Source Source { get; set; }\n\nThe location of the function source code.\n\n### SourceProvenance\n\n public SourceProvenance SourceProvenance { get; set; }\n\nOutput only. A permanent fixed identifier for source.\n\n### WorkerPool\n\n public string WorkerPool { get; set; }\n\nName of the Cloud Build Custom Worker Pool that should be used to build the\nfunction. The format of this field is\n`projects/{project}/locations/{region}/workerPools/{workerPool}` where\n{project} and {region} are the project id and region respectively where the\nworker pool is defined and {workerPool} is the short name of the worker\npool.\n\nIf the project id is not the same as the function, then the Cloud\nFunctions Service Agent\n(service-\\<project_number\\>@gcf-admin-robot.iam.gserviceaccount.com) must be\ngranted the role Cloud Build Custom Workers Builder\n(roles/cloudbuild.customworkers.builder) in the project.\n\n### WorkerPoolAsWorkerPoolName\n\n public WorkerPoolName WorkerPoolAsWorkerPoolName { get; set; }\n\n[WorkerPoolName](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.WorkerPoolName)-typed view over the [WorkerPool](/dotnet/docs/reference/Google.Cloud.Functions.V2/latest/Google.Cloud.Functions.V2.BuildConfig#Google_Cloud_Functions_V2_BuildConfig_WorkerPool) resource name property."]]