airflow.providers.google.cloud.operators.cloud_build

Operators that integrate with Google Cloud Build service.

Module Contents

airflow.providers.google.cloud.operators.cloud_build.REGEX_REPO_PATH[source]
class airflow.providers.google.cloud.operators.cloud_build.BuildProcessor(body: dict)[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

body (dict) -- The request body. See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds

_verify_source(self)[source]
_reformat_source(self)[source]
_reformat_repo_source(self)[source]
_reformat_storage_source(self)[source]
process_body(self)[source]

Processes the body passed in the constructor

Returns

the body.

Type

dict

static _convert_repo_url_to_dict(source)[source]

Convert url to repository in Google Cloud Source to a format supported by the API

Example valid input:

https://source.developers.google.com/p/airflow-project/r/airflow-repo#branch-name
static _convert_storage_url_to_dict(storage_url: str)[source]

Convert url to object in Google Cloud Storage to a format supported by the API

Example valid input:

gs://bucket-name/object-name.tar.gz
class airflow.providers.google.cloud.operators.cloud_build.CloudBuildCreateBuildOperator(*, body: Union[dict, str], project_id: Optional[str] = None, gcp_conn_id: str = 'google_cloud_default', api_version: str = 'v1', 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: Trigger a build

Parameters
  • body (dict or string) -- The build config with instructions to perform with CloudBuild. Can be a dictionary or path to a file type like YAML or JSON. See: https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds

  • project_id (str) -- ID of the Google Cloud project if None then default project_id is used.

  • gcp_conn_id (str) -- The connection ID to use to connect to Google Cloud.

  • api_version (str) -- API version used (for example v1 or v1beta1).

  • 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).

template_fields = ['body', 'gcp_conn_id', 'api_version', 'impersonation_chain'][source]
template_ext = ['.yml', '.yaml', '.json'][source]
prepare_template(self)[source]
_validate_inputs(self)[source]
execute(self, context)[source]

Was this entry helpful?