blob: a461e0f7a04a2302fdbfa48253b25d9c54326522 [file] [log] [blame]
:py:mod:`airflow.providers.google.cloud.hooks.cloud_build`
==========================================================
.. py:module:: airflow.providers.google.cloud.hooks.cloud_build
.. autoapi-nested-parse::
Hook for Google Cloud Build service.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.cloud_build.CloudBuildHook
Attributes
~~~~~~~~~~
.. autoapisummary::
airflow.providers.google.cloud.hooks.cloud_build.TIME_TO_SLEEP_IN_SECONDS
.. py:data:: TIME_TO_SLEEP_IN_SECONDS
:annotation: = 5
.. py:class:: CloudBuildHook(gcp_conn_id = 'google_cloud_default', delegate_to = None, impersonation_chain = None)
Bases: :py:obj:`airflow.providers.google.common.hooks.base_google.GoogleBaseHook`
Hook for the Google Cloud Build Service.
:param gcp_conn_id: The connection ID to use when fetching connection info.
:param delegate_to: The account to impersonate using domain-wide delegation of authority,
if any. For this to work, the service account making the request must have
domain-wide delegation enabled.
:param impersonation_chain: Optional service account to impersonate using short-term
credentials, or chained list of accounts required to get the access_token
of the last account in the list, which will be impersonated in the request.
If set as a string, the account must grant the originating account
the Service Account Token Creator IAM role.
If set as a sequence, the identities from the list must grant
Service Account Token Creator IAM role to the directly preceding identity, with first
account from the list granting this role to the originating account.
.. py:method:: get_conn(self)
Retrieves the connection to Google Cloud Build.
:return: Google Cloud Build client object.
:rtype: `google.cloud.devtools.cloudbuild_v1.CloudBuildClient`
.. py:method:: cancel_build(self, id_, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
Cancels a build in progress.
:param id_: The ID of the build.
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.Build`
.. py:method:: create_build(self, build, project_id = PROVIDE_PROJECT_ID, wait = True, retry = DEFAULT, timeout = None, metadata = ())
Starts a build with the specified configuration.
:param build: The build resource to create. If a dict is provided, it must be of the same form
as the protobuf message `google.cloud.devtools.cloudbuild_v1.types.Build`
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param wait: Optional, wait for operation to finish.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.Build`
.. py:method:: create_build_trigger(self, trigger, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
Creates a new BuildTrigger.
:param trigger: The BuildTrigger to create. If a dict is provided, it must be of the same form
as the protobuf message `google.cloud.devtools.cloudbuild_v1.types.BuildTrigger`
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.BuildTrigger`
.. py:method:: delete_build_trigger(self, trigger_id, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
Deletes a BuildTrigger by its project ID and trigger ID.
:param trigger_id: The ID of the BuildTrigger to delete.
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
.. py:method:: get_build(self, id_, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
Returns information about a previously requested build.
:param id_: The ID of the build.
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.Build`
.. py:method:: get_build_trigger(self, trigger_id, project_id = PROVIDE_PROJECT_ID, retry = DEFAULT, timeout = None, metadata = ())
Returns information about a BuildTrigger.
:param trigger_id: The ID of the BuildTrigger to get.
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.BuildTrigger`
.. py:method:: list_build_triggers(self, location, project_id = PROVIDE_PROJECT_ID, page_size = None, page_token = None, retry = DEFAULT, timeout = None, metadata = ())
Lists existing BuildTriggers.
:param project_id: Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param location: The location of the project.
:param page_size: Optional, number of results to return in the list.
:param page_token: Optional, token to provide to skip to a particular spot in the list.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.BuildTrigger`
.. py:method:: list_builds(self, location, project_id = PROVIDE_PROJECT_ID, page_size = None, page_token = None, filter_ = None, retry = DEFAULT, timeout = None, metadata = ())
Lists previously requested builds.
:param project_id: Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the Google Cloud connection is used.
:param location: The location of the project.
:param page_size: Optional, number of results to return in the list.
:param page_token: Optional, token to provide to skip to a particular spot in the list.
:param filter_: Optional, the raw filter text to constrain the results.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: List[`google.cloud.devtools.cloudbuild_v1.types.Build`]
.. py:method:: retry_build(self, id_, project_id = PROVIDE_PROJECT_ID, wait = True, retry = DEFAULT, timeout = None, metadata = ())
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.
:param id_: Build ID of the original build.
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param wait: Optional, wait for operation to finish.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.Build`
.. py:method:: run_build_trigger(self, trigger_id, source, project_id = PROVIDE_PROJECT_ID, wait = True, retry = DEFAULT, timeout = None, metadata = ())
Runs a BuildTrigger at a particular source revision.
:param trigger_id: The ID of the trigger.
:param source: Source to build against this trigger. If a dict is provided, it must be of the
same form as the protobuf message `google.cloud.devtools.cloudbuild_v1.types.RepoSource`
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param wait: Optional, wait for operation to finish.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.Build`
.. py:method:: update_build_trigger(self, trigger_id, trigger, project_id, retry = DEFAULT, timeout = None, metadata = ())
Updates a BuildTrigger by its project ID and trigger ID.
:param trigger_id: The ID of the trigger.
:param trigger: The BuildTrigger to create. If a dict is provided, it must be of the same form
as the protobuf message `google.cloud.devtools.cloudbuild_v1.types.BuildTrigger`
:param project_id: Optional, Google Cloud Project project_id where the function belongs.
If set to None or missing, the default project_id from the GCP connection is used.
:param retry: Optional, a retry object used to retry requests. If `None` is specified, requests
will not be retried.
:param timeout: Optional, the amount of time, in seconds, to wait for the request to complete.
Note that if `retry` is specified, the timeout applies to each individual attempt.
:param metadata: Optional, additional metadata that is provided to the method.
:rtype: `google.cloud.devtools.cloudbuild_v1.types.BuildTrigger`