CloudBuildClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.devtools.cloudbuild_v1.services.cloud_build.transports.base.CloudBuildTransport] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-cloudbuild/.nox/docfx/lib/python3.8/site-packages/google/api_core/client_options.py'> = None)
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.
Inheritance
builtins.object > CloudBuildClientMethods
CloudBuildClient
CloudBuildClient(*, credentials: google.auth.credentials.Credentials = None, transport: Union[str, google.cloud.devtools.cloudbuild_v1.services.cloud_build.transports.base.CloudBuildTransport] = None, client_options: <module 'google.api_core.client_options' from '/workspace/python-cloudbuild/.nox/docfx/lib/python3.8/site-packages/google/api_core/client_options.py'> = None)
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, `.CloudBuildTransport`]
The transport to use. If set to None, a transport is chosen automatically. |
client_options |
ClientOptions
Custom options for the client. It won't take effect if a |
Type | Description |
google.auth.exceptions.MutualTLSChannelError | If mutual TLS transport creation failed for any reason. |
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 |
`.cloudbuild.CancelBuildRequest`
The request object. Request to cancel an ongoing build. |
project_id |
`str`
Required. ID of the project. This corresponds to the |
id |
`str`
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 |
`.cloudbuild.Build` | 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. |
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 |
`.cloudbuild.CreateBuildRequest`
The request object. Request to create a new build. |
project_id |
`str`
Required. ID of the project. This corresponds to the |
build |
`.cloudbuild.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 |
`.operation.Operation` | An object representing a long-running operation. The result type for the operation will be ```.cloudbuild.Build```: 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. |
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 |
`.cloudbuild.CreateBuildTriggerRequest`
The request object. Request to create a new |
project_id |
`str`
Required. ID of the project for which to configure automatic builds. This corresponds to the |
trigger |
`.cloudbuild.BuildTrigger`
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 |
`.cloudbuild.BuildTrigger` | 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 |
`.cloudbuild.CreateWorkerPoolRequest`
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 |
`.cloudbuild.WorkerPool` | 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 |
`.cloudbuild.DeleteBuildTriggerRequest`
The request object. Request to delete a |
project_id |
`str`
Required. ID of the project that owns the trigger. This corresponds to the |
trigger_id |
`str`
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 |
`.cloudbuild.DeleteWorkerPoolRequest`
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 |
`.cloudbuild.GetBuildRequest`
The request object. Request to get a build. |
project_id |
`str`
Required. ID of the project. This corresponds to the |
id |
`str`
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 |
`.cloudbuild.Build` | 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 |
`.cloudbuild.GetBuildTriggerRequest`
The request object. Returns the |
project_id |
`str`
Required. ID of the project that owns the trigger. This corresponds to the |
trigger_id |
`str`
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 |
`.cloudbuild.BuildTrigger` | 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 |
`.cloudbuild.GetWorkerPoolRequest`
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 |
`.cloudbuild.WorkerPool` | 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 |
`.cloudbuild.ListBuildTriggersRequest`
The request object. Request to list existing |
project_id |
`str`
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 |
`.pagers.ListBuildTriggersPager` | 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 |
`.cloudbuild.ListBuildsRequest`
The request object. Request to list builds. |
project_id |
`str`
Required. ID of the project. This corresponds to the |
filter |
`str`
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 |
`.pagers.ListBuildsPager` | 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 |
`.cloudbuild.ListWorkerPoolsRequest`
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 |
`.cloudbuild.ListWorkerPoolsResponse` | Response containing existing ``WorkerPools``. |
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 |
`.cloudbuild.RetryBuildRequest`
The request object. Specifies a build to retry. |
project_id |
`str`
Required. ID of the project. This corresponds to the |
id |
`str`
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 |
`.operation.Operation` | An object representing a long-running operation. The result type for the operation will be ```.cloudbuild.Build```: 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. |
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 |
`.cloudbuild.RunBuildTriggerRequest`
The request object. Specifies a build trigger to run and the source to use. |
project_id |
`str`
Required. ID of the project. This corresponds to the |
trigger_id |
`str`
Required. ID of the trigger. This corresponds to the |
source |
`.cloudbuild.RepoSource`
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 |
`.operation.Operation` | An object representing a long-running operation. The result type for the operation will be ```.cloudbuild.Build```: 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. |
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 |
`.cloudbuild.UpdateBuildTriggerRequest`
The request object. Request to update an existing |
project_id |
`str`
Required. ID of the project that owns the trigger. This corresponds to the |
trigger_id |
`str`
Required. ID of the |
trigger |
`.cloudbuild.BuildTrigger`
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 |
`.cloudbuild.BuildTrigger` | 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 |
`.cloudbuild.UpdateWorkerPoolRequest`
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 |
`.cloudbuild.WorkerPool` | 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. |