airflow.providers.google.cloud.operators.cloud_build
¶
Operators that integrates with Google Cloud Build service.
Module Contents¶
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildCancelBuildOperator
(*, id_: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Cancels a build in progress.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildCancelBuildOperator
- Parameters
id (str) -- The ID of the build.
project_id (Optional[str]) -- 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.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildCreateBuildOperator
(*, build: Optional[Union[Dict, Build, str]] = None, body: Optional[Dict] = None, project_id: Optional[str] = None, wait: bool = True, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Starts a build with the specified configuration.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildCreateBuildOperator
- Parameters
build (Optional[Union[dict, google.cloud.devtools.cloudbuild_v1.types.Build]]) -- Optional, 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. Only either build or body should be passed.
body (Optional[dict]) -- (Deprecated) The build resource to create. This parameter has been deprecated. You should pass the build parameter instead.
project_id (Optional[str]) -- 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.
wait (Optional[bool]) -- Optional, wait for operation to finish.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildCreateBuildTriggerOperator
(*, trigger: Union[dict, BuildTrigger], project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Creates a new BuildTrigger.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildCreateBuildTriggerOperator
- Parameters
trigger (Union[dict, google.cloud.devtools.cloudbuild_v1.types.BuildTrigger]) -- 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
project_id (Optional[str]) -- 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.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildDeleteBuildTriggerOperator
(*, trigger_id: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Deletes a BuildTrigger by its project ID and trigger ID.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildDeleteBuildTriggerOperator
- Parameters
trigger_id (str) -- The ID of the BuildTrigger to delete.
project_id (Optional[str]) -- 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.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildGetBuildOperator
(*, id_: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Returns information about a previously requested build.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildGetBuildOperator
- Parameters
id (str) -- The ID of the build.
project_id (Optional[str]) -- 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.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildGetBuildTriggerOperator
(*, trigger_id: str, project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Returns information about a BuildTrigger.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildGetBuildTriggerOperator
- Parameters
trigger_id (str) -- The ID of the BuildTrigger to get.
project_id (Optional[str]) -- 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.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildListBuildTriggersOperator
(*, location: str, project_id: Optional[str] = None, page_size: Optional[int] = None, page_token: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Lists existing BuildTriggers.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildListBuildTriggersOperator
- Parameters
location (string) -- The location of the project.
project_id (Optional[str]) -- 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.
page_size (Optional[int]) -- Optional, number of results to return in the list.
page_token (Optional[str]) -- Optional, token to provide to skip to a particular spot in the list.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
List[dict]
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildListBuildsOperator
(*, location: str, project_id: Optional[str] = None, page_size: Optional[int] = None, filter_: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Lists previously requested builds.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildListBuildsOperator
- Parameters
location (string) -- The location of the project.
project_id (str) -- 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.
page_size (Optional[int]) -- Optional, number of results to return in the list.
filter (Optional[str]) -- Optional, the raw filter text to constrain the results.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
List[dict]
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildRetryBuildOperator
(*, id_: str, project_id: Optional[str] = None, wait: bool = True, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
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.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildRetryBuildOperator
- Parameters
id (str) -- Build ID of the original build.
project_id (str) -- 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.
wait (Optional[bool]) -- Optional, wait for operation to finish.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildRunBuildTriggerOperator
(*, trigger_id: str, source: Union[dict, RepoSource], project_id: Optional[str] = None, wait: bool = True, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Runs a BuildTrigger at a particular source revision.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildRunBuildTriggerOperator
- Parameters
trigger_id (str) -- The ID of the trigger.
source (Union[dict, google.cloud.devtools.cloudbuild_v1.types.RepoSource]) -- 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
project_id (str) -- 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.
wait (Optional[bool]) -- Optional, wait for operation to finish.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
CloudBuildUpdateBuildTriggerOperator
(*, trigger_id: str, trigger: Union[dict, BuildTrigger], project_id: Optional[str] = None, retry: Optional[Retry] = None, timeout: Optional[float] = None, metadata: Optional[Sequence[Tuple[str, str]]] = None, gcp_conn_id: str = 'google_cloud_default', impersonation_chain: Optional[Union[str, Sequence[str]]] = None, **kwargs)[source]¶ Bases:
airflow.models.BaseOperator
Updates a BuildTrigger by its project ID and trigger ID.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildUpdateBuildTriggerOperator
- Parameters
trigger_id (str) -- The ID of the trigger.
trigger (Union[dict, google.cloud.devtools.cloudbuild_v1.types.BuildTrigger]) -- 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
project_id (Optional[str]) -- 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.
retry (Optional[Retry]) -- Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (Optional[float]) -- 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.
metadata (Optional[Sequence[Tuple[str, str]]]) -- Optional, additional metadata that is provided to the method.
gcp_conn_id (Optional[str]) -- Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (Union[str, Sequence[str]]) -- 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 (templated).
- Return type
-
class
airflow.providers.google.cloud.operators.cloud_build.
BuildProcessor
(build: Union[Dict, Build])[source]¶ Processes build configurations to add additional functionality to support the use of operators. The following improvements are made: * It is required to provide the source and only one type can be given, * It is possible to provide the source as the URL address instead dict.
- Parameters
build (Union[Dict, Build]) -- The request body of the build. See: https://cloud.google.com/cloud-build/docs/api/reference/rest/Shared.Types/Build