# Google Cloud Functions V2 Client - Class BuildConfig (2.1.3)

2.1.3 (latest) 2.1.2 2.0.6 1.7.0 1.6.5 1.5.0 1.4.2 1.3.1 1.2.0 1.1.2 1.0.3 Reference documentation and code samples for the Google Cloud Functions V2 Client class BuildConfig.

Describes the Build step of the function that builds a container from the
given source.

Generated from protobuf message `google.cloud.functions.v2.BuildConfig`

## Namespace

Google \\ Cloud \\ Functions \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ automatic_update_policy` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.AutomaticUpdatePolicy` |
| `↳ on_deploy_update_policy` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.OnDeployUpdatePolicy` |
| `↳ build` | `string` Output only. The Cloud Build name of the latest successful deployment of the function. |
| `↳ runtime` | `string` 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](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime). |
| `↳ entry_point` | `string` 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`. |
| `↳ source` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.Source` The location of the function source code. |
| `↳ source_provenance` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SourceProvenance` Output only. A permanent fixed identifier for source. |
| `↳ worker_pool` | `string` 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. |
| `↳ environment_variables` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` User-provided build-time environment variables for the function |
| `↳ docker_registry` | `int` Docker Registry to use for this deployment. This configuration is only applicable to 1st Gen functions, 2nd Gen functions can only use Artifact Registry. Deprecated: As of March 2025, `CONTAINER_REGISTRY` option is no longer available in response to Container Registry's deprecation: <https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr> Please use Artifact Registry instead, which is the default choice. 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`. |
| `↳ docker_repository` | `string` 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}`. Repository format must be 'DOCKER'. |
| `↳ service_account` | `string` Service account to be used for building the container. The format of this field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`. |

### getAutomaticUpdatePolicy

Generated from protobuf field `.google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.AutomaticUpdatePolicy|null` |   |

### hasAutomaticUpdatePolicy

### setAutomaticUpdatePolicy

Generated from protobuf field `.google.cloud.functions.v2.AutomaticUpdatePolicy automatic_update_policy = 40;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.AutomaticUpdatePolicy` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOnDeployUpdatePolicy

Generated from protobuf field `.google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.OnDeployUpdatePolicy|null` |   |

### hasOnDeployUpdatePolicy

### setOnDeployUpdatePolicy

Generated from protobuf field `.google.cloud.functions.v2.OnDeployUpdatePolicy on_deploy_update_policy = 41;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.OnDeployUpdatePolicy` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBuild

Output only. The Cloud Build name of the latest successful deployment of
the function.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setBuild

Output only. The Cloud Build name of the latest successful deployment of
the function.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRuntime

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](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setRuntime

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](https://cloud.google.com/sdk/gcloud/reference/functions/deploy#--runtime).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEntryPoint

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`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setEntryPoint

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`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSource

The location of the function source code.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.Source|null` |   |

### hasSource

### clearSource

### setSource

The location of the function source code.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.Source` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSourceProvenance

Output only. A permanent fixed identifier for source.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SourceProvenance|null` |   |

### hasSourceProvenance

### clearSourceProvenance

### setSourceProvenance

Output only. A permanent fixed identifier for source.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.SourceProvenance` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getWorkerPool

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.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setWorkerPool

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.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEnvironmentVariables

User-provided build-time environment variables for the function

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setEnvironmentVariables

User-provided build-time environment variables for the function

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDockerRegistry

Docker Registry to use for this deployment. This configuration is only
applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
Registry.

Deprecated: As of March 2025, `CONTAINER_REGISTRY` option is no longer
available in response to Container Registry's deprecation:
<https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr>
Please use Artifact Registry instead, which is the default choice.
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`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [DockerRegistry](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.BuildConfig.DockerRegistry). |

### setDockerRegistry

Docker Registry to use for this deployment. This configuration is only
applicable to 1st Gen functions, 2nd Gen functions can only use Artifact
Registry.

Deprecated: As of March 2025, `CONTAINER_REGISTRY` option is no longer
available in response to Container Registry's deprecation:
<https://cloud.google.com/artifact-registry/docs/transition/transition-from-gcr>
Please use Artifact Registry instead, which is the default choice.
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`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [DockerRegistry](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.BuildConfig.DockerRegistry). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDockerRepository

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}`.
Repository format must be 'DOCKER'.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDockerRepository

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}`.
Repository format must be 'DOCKER'.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getServiceAccount

Service account to be used for building the container. The format of this
field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setServiceAccount

Service account to be used for building the container. The format of this
field is `projects/{projectId}/serviceAccounts/{serviceAccountEmail}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRuntimeUpdatePolicy

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |