airflow.providers.google.cloud.operators.cloud_build
¶
Operators that integrates with Google Cloud Build service.
Module Contents¶
Classes¶
Cancels a build in progress. |
|
Starts a build with the specified configuration. |
|
Creates a new BuildTrigger. |
|
Deletes a BuildTrigger by its project ID and trigger ID. |
|
Returns information about a previously requested build. |
|
Returns information about a BuildTrigger. |
|
Lists existing BuildTriggers. |
|
Lists previously requested builds. |
|
Creates a new build using the original build request, which may or may not result in an identical build. |
|
Runs a BuildTrigger at a particular source revision. |
|
Updates a BuildTrigger by its project ID and trigger ID. |
|
Processes build configurations to add additional functionality to support the use of operators. |
Attributes¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildCancelBuildOperator(*, id_, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 – The ID of the 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.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'id_', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildCreateBuildOperator(*, build, project_id=PROVIDE_PROJECT_ID, wait=True, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, poll_interval=4.0, deferrable=conf.getboolean('operators', 'default_deferrable', fallback=False), location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 (dict | google.cloud.devtools.cloudbuild_v1.types.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.
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 (bool) – Optional, wait for operation to finish.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
retry – Designation of what errors, if any, should be retried.
timeout – The timeout for this request.
metadata – Strings which should be sent along with the request as metadata.
deferrable (bool) – Run operator in the deferrable mode
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'build', 'gcp_conn_id', 'impersonation_chain', 'location')[source]¶
- prepare_template()[source]¶
Execute after the templated fields get replaced by their content.
If you need your object to alter the content of the file before the template is rendered, it should override this method to do so.
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildCreateBuildTriggerOperator(*, trigger, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Creates a new BuildTrigger.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildCreateBuildTriggerOperator
- Parameters
trigger (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 (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 (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'trigger', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildDeleteBuildTriggerOperator(*, trigger_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 (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 (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'trigger_id', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildGetBuildOperator(*, id_, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 – The ID of the 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.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'id_', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildGetBuildTriggerOperator(*, trigger_id, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 (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 (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'trigger_id', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildListBuildTriggersOperator(*, location='global', project_id=PROVIDE_PROJECT_ID, page_size=None, page_token=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Lists existing BuildTriggers.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildListBuildTriggersOperator
- Parameters
location (str) – 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 (int | None) – Optional, number of results to return in the list.
page_token (str | None) – Optional, token to provide to skip to a particular spot in the list.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
- template_fields: collections.abc.Sequence[str] = ('location', 'project_id', 'gcp_conn_id')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildListBuildsOperator(*, location='global', project_id=PROVIDE_PROJECT_ID, page_size=None, filter_=None, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
Lists previously requested builds.
See also
For more information on how to use this operator, take a look at the guide: CloudBuildListBuildsOperator
- Parameters
location (str) – 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 (int | None) – Optional, number of results to return in the list.
filter – Optional, the raw filter text to constrain the results.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
- template_fields: collections.abc.Sequence[str] = ('location', 'project_id', 'gcp_conn_id')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildRetryBuildOperator(*, id_, project_id=PROVIDE_PROJECT_ID, wait=True, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 – 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 (bool) – Optional, wait for operation to finish.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'id_', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildRunBuildTriggerOperator(*, trigger_id, source, project_id=PROVIDE_PROJECT_ID, wait=True, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 (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 (bool) – Optional, wait for operation to finish.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'trigger_id', 'source', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.CloudBuildUpdateBuildTriggerOperator(*, trigger_id, trigger, project_id=PROVIDE_PROJECT_ID, retry=DEFAULT, timeout=None, metadata=(), gcp_conn_id='google_cloud_default', impersonation_chain=None, location='global', **kwargs)[source]¶
Bases:
airflow.providers.google.cloud.operators.cloud_base.GoogleCloudBaseOperator
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 (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 (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 (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Optional, a retry object used to retry requests. If None is specified, requests will not be retried.
timeout (float | None) – 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 (collections.abc.Sequence[tuple[str, str]]) – Optional, additional metadata that is provided to the method.
gcp_conn_id (str) – Optional, the connection ID used to connect to Google Cloud Platform.
impersonation_chain (str | collections.abc.Sequence[str] | None) – 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).
location (str) – The location of the project.
- template_fields: collections.abc.Sequence[str] = ('project_id', 'trigger_id', 'trigger', 'gcp_conn_id', 'location')[source]¶
- class airflow.providers.google.cloud.operators.cloud_build.BuildProcessor(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 (dict | google.cloud.devtools.cloudbuild_v1.types.Build) – The request body of the build. See: https://cloud.google.com/cloud-build/docs/api/reference/rest/Shared.Types/Build