CloudBuildClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Optional[Union[str, google.cloud.devtools.cloudbuild_v1.services.cloud_build.transports.base.CloudBuildTransport]] = None, client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Creates and manages builds on Google Cloud Platform.
The main concept used by this API is a Build
, which describes
the location of the source to build, how to build the source, and
where to store the built artifacts, if any.
A user can list previously-requested builds or get builds by their ID to determine the status of the build.
Properties
transport
Return the transport used by the client instance.
Type | Description |
CloudBuildTransport | The transport used by the client instance. |
Methods
CloudBuildClient
CloudBuildClient(*, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Optional[Union[str, google.cloud.devtools.cloudbuild_v1.services.cloud_build.transports.base.CloudBuildTransport]] = None, client_options: Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)
Instantiate the cloud build client.
Name | Description |
credentials |
Optional[google.auth.credentials.Credentials]
The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. |
transport |
Union[str,
The transport to use. If set to None, a transport is chosen automatically. |
client_options |
client_options_lib.ClientOptions
Custom options for the client. It won't take effect if a |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
Type | Description |
google.auth.exceptions.MutualTLSChannelError | If mutual TLS transport creation failed for any reason. |
build_path
build_path(project: str, build: str)
Return a fully-qualified build string.
build_trigger_path
build_trigger_path(project: str, trigger: str)
Return a fully-qualified build_trigger string.
cancel_build
cancel_build(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.CancelBuildRequest] = None, *, project_id: Optional[str] = None, id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Cancels a build in progress.
Name | Description |
request |
The request object. Request to cancel an ongoing build. |
project_id |
Required. ID of the project. This corresponds to the |
id |
Required. ID of the build. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| A build resource in the Cloud Build API. At a high level, a Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts. Fields can include the following variables, which will be expanded when the build is created: - $PROJECT_ID: the project ID of the build. - $BUILD_ID: the autogenerated ID of the build. - $REPO_NAME: the source repository name specified by RepoSource. - $BRANCH_NAME: the branch name specified by RepoSource. - $TAG_NAME: the tag name specified by RepoSource. - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag. - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. |
common_billing_account_path
common_billing_account_path(billing_account: str)
Return a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str)
Return a fully-qualified folder string.
common_location_path
common_location_path(project: str, location: str)
Return a fully-qualified location string.
common_organization_path
common_organization_path(organization: str)
Return a fully-qualified organization string.
common_project_path
common_project_path(project: str)
Return a fully-qualified project string.
create_build
create_build(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.CreateBuildRequest] = None, *, project_id: Optional[str] = None, build: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.Build] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Starts a build with the specified configuration.
This method returns a long-running Operation
, which includes
the build ID. Pass the build ID to GetBuild
to determine the
build status (such as SUCCESS
or FAILURE
).
Name | Description |
request |
The request object. Request to create a new build. |
project_id |
Required. ID of the project. This corresponds to the |
build |
Required. Build resource to create. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| An object representing a long-running operation. The result type for the operation will be .cloudbuild.Build Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts. Fields can include the following variables, which will be expanded when the build is created: - $PROJECT_ID: the project ID of the build. - $BUILD_ID: the autogenerated ID of the build. - $REPO_NAME: the source repository name specified by RepoSource. - $BRANCH_NAME: the branch name specified by RepoSource. - $TAG_NAME: the tag name specified by RepoSource. - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag. - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. |
create_build_trigger
create_build_trigger(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.CreateBuildTriggerRequest] = None, *, project_id: Optional[str] = None, trigger: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.BuildTrigger] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Creates a new BuildTrigger
.
This API is experimental.
Name | Description |
request |
The request object. Request to create a new |
project_id |
Required. ID of the project for which to configure automatic builds. This corresponds to the |
trigger |
Required. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Configuration for an automated build in response to source repository changes. |
create_worker_pool
create_worker_pool(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.CreateWorkerPoolRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Creates a WorkerPool
to run the builds, and returns the new
worker pool.
This API is experimental.
Name | Description |
request |
The request object. Request to create a new |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Configuration for a WorkerPool to run the builds. Workers are machines that Cloud Build uses to run your builds. By default, all workers run in a project owned by Cloud Build. To have full control over the workers that execute your builds -- such as enabling them to access private resources on your private network -- you can request Cloud Build to run the workers in your own project by creating a custom workers pool. |
delete_build_trigger
delete_build_trigger(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.DeleteBuildTriggerRequest] = None, *, project_id: Optional[str] = None, trigger_id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Deletes a BuildTrigger
by its project ID and trigger ID.
This API is experimental.
Name | Description |
request |
The request object. Request to delete a |
project_id |
Required. ID of the project that owns the trigger. This corresponds to the |
trigger_id |
Required. ID of the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
delete_worker_pool
delete_worker_pool(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.DeleteWorkerPoolRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Deletes a WorkerPool
by its project ID and WorkerPool name.
This API is experimental.
Name | Description |
request |
The request object. Request to delete a |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
from_service_account_file
from_service_account_file(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
{@api.name} | The constructed client. |
from_service_account_json
from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
{@api.name} | The constructed client. |
get_build
get_build(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.GetBuildRequest] = None, *, project_id: Optional[str] = None, id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Returns information about a previously requested build.
The Build
that is returned includes its status (such as
SUCCESS
, FAILURE
, or WORKING
), and timing
information.
Name | Description |
request |
The request object. Request to get a build. |
project_id |
Required. ID of the project. This corresponds to the |
id |
Required. ID of the build. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| A build resource in the Cloud Build API. At a high level, a Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts. Fields can include the following variables, which will be expanded when the build is created: - $PROJECT_ID: the project ID of the build. - $BUILD_ID: the autogenerated ID of the build. - $REPO_NAME: the source repository name specified by RepoSource. - $BRANCH_NAME: the branch name specified by RepoSource. - $TAG_NAME: the tag name specified by RepoSource. - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag. - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. |
get_build_trigger
get_build_trigger(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.GetBuildTriggerRequest] = None, *, project_id: Optional[str] = None, trigger_id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Returns information about a BuildTrigger
.
This API is experimental.
Name | Description |
request |
The request object. Returns the |
project_id |
Required. ID of the project that owns the trigger. This corresponds to the |
trigger_id |
Required. Identifier ( |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Configuration for an automated build in response to source repository changes. |
get_worker_pool
get_worker_pool(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.GetWorkerPoolRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Returns information about a WorkerPool
.
This API is experimental.
Name | Description |
request |
The request object. Request to get a |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Configuration for a WorkerPool to run the builds. Workers are machines that Cloud Build uses to run your builds. By default, all workers run in a project owned by Cloud Build. To have full control over the workers that execute your builds -- such as enabling them to access private resources on your private network -- you can request Cloud Build to run the workers in your own project by creating a custom workers pool. |
list_build_triggers
list_build_triggers(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.ListBuildTriggersRequest] = None, *, project_id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists existing BuildTrigger
\ s.
This API is experimental.
Name | Description |
request |
The request object. Request to list existing |
project_id |
Required. ID of the project for which to list BuildTriggers. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response containing existing BuildTriggers . Iterating over this object will yield results and resolve additional pages automatically. |
list_builds
list_builds(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.ListBuildsRequest] = None, *, project_id: Optional[str] = None, filter: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Lists previously requested builds. Previously requested builds may still be in-progress, or may have finished successfully or unsuccessfully.
Name | Description |
request |
The request object. Request to list builds. |
project_id |
Required. ID of the project. This corresponds to the |
filter |
The raw filter text to constrain the results. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response including listed builds. Iterating over this object will yield results and resolve additional pages automatically. |
list_worker_pools
list_worker_pools(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.ListWorkerPoolsRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
List project's WorkerPools
.
This API is experimental.
Name | Description |
request |
The request object. Request to list |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Response containing existing WorkerPools . |
parse_build_path
parse_build_path(path: str)
Parse a build path into its component segments.
parse_build_trigger_path
parse_build_trigger_path(path: str)
Parse a build_trigger path into its component segments.
parse_common_billing_account_path
parse_common_billing_account_path(path: str)
Parse a billing_account path into its component segments.
parse_common_folder_path
parse_common_folder_path(path: str)
Parse a folder path into its component segments.
parse_common_location_path
parse_common_location_path(path: str)
Parse a location path into its component segments.
parse_common_organization_path
parse_common_organization_path(path: str)
Parse a organization path into its component segments.
parse_common_project_path
parse_common_project_path(path: str)
Parse a project path into its component segments.
parse_service_account_path
parse_service_account_path(path: str)
Parse a service_account path into its component segments.
retry_build
retry_build(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.RetryBuildRequest] = None, *, project_id: Optional[str] = None, id: Optional[str] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Creates a new build based on the specified build.
This method creates a new build using the original build request, which may or may not result in an identical build.
For triggered builds:
- Triggered builds resolve to a precise revision; therefore a retry of a triggered build will result in a build that uses the same revision.
For non-triggered builds that specify RepoSource
:
- If the original build built from the tip of a branch, the retried build will build from the tip of that branch, which may not be the same revision as the original build.
- If the original build specified a commit sha or revision ID, the retried build will use the identical source.
For builds that specify StorageSource
:
- If the original build pulled source from Google Cloud Storage without specifying the generation of the object, the new build will use the current object, which may be different from the original build source.
- If the original build pulled source from Cloud Storage and specified the generation of the object, the new build will attempt to use the same object, which may or may not be available depending on the bucket's lifecycle management settings.
Name | Description |
request |
The request object. Specifies a build to retry. |
project_id |
Required. ID of the project. This corresponds to the |
id |
Required. Build ID of the original build. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| An object representing a long-running operation. The result type for the operation will be .cloudbuild.Build Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts. Fields can include the following variables, which will be expanded when the build is created: - $PROJECT_ID: the project ID of the build. - $BUILD_ID: the autogenerated ID of the build. - $REPO_NAME: the source repository name specified by RepoSource. - $BRANCH_NAME: the branch name specified by RepoSource. - $TAG_NAME: the tag name specified by RepoSource. - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag. - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. |
run_build_trigger
run_build_trigger(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.RunBuildTriggerRequest] = None, *, project_id: Optional[str] = None, trigger_id: Optional[str] = None, source: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.RepoSource] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Runs a BuildTrigger
at a particular source revision.
Name | Description |
request |
The request object. Specifies a build trigger to run and the source to use. |
project_id |
Required. ID of the project. This corresponds to the |
trigger_id |
Required. ID of the trigger. This corresponds to the |
source |
Required. Source to build against this trigger. This corresponds to the |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| An object representing a long-running operation. The result type for the operation will be .cloudbuild.Build Build describes where to find source code, how to build it (for example, the builder image to run on the source), and where to store the built artifacts. Fields can include the following variables, which will be expanded when the build is created: - $PROJECT_ID: the project ID of the build. - $BUILD_ID: the autogenerated ID of the build. - $REPO_NAME: the source repository name specified by RepoSource. - $BRANCH_NAME: the branch name specified by RepoSource. - $TAG_NAME: the tag name specified by RepoSource. - $REVISION_ID or $COMMIT_SHA: the commit SHA specified by RepoSource or resolved from the specified branch or tag. - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA. |
service_account_path
service_account_path(project: str, service_account: str)
Return a fully-qualified service_account string.
update_build_trigger
update_build_trigger(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.UpdateBuildTriggerRequest] = None, *, project_id: Optional[str] = None, trigger_id: Optional[str] = None, trigger: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.BuildTrigger] = None, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Updates a BuildTrigger
by its project ID and trigger ID.
This API is experimental.
Name | Description |
request |
The request object. Request to update an existing |
project_id |
Required. ID of the project that owns the trigger. This corresponds to the |
trigger_id |
Required. ID of the |
trigger |
Required. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Configuration for an automated build in response to source repository changes. |
update_worker_pool
update_worker_pool(request: Optional[google.cloud.devtools.cloudbuild_v1.types.cloudbuild.UpdateWorkerPoolRequest] = None, *, retry: google.api_core.retry.Retry = <_MethodDefault._DEFAULT_VALUE: <object object>>, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = ())
Update a WorkerPool
.
This API is experimental.
Name | Description |
request |
The request object. Request to update a |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, str]]
Strings which should be sent along with the request as metadata. |
Type | Description |
| Configuration for a WorkerPool to run the builds. Workers are machines that Cloud Build uses to run your builds. By default, all workers run in a project owned by Cloud Build. To have full control over the workers that execute your builds -- such as enabling them to access private resources on your private network -- you can request Cloud Build to run the workers in your own project by creating a custom workers pool. |