Google Cloud Build Operators¶
The GoogleCloud Build is a service that executes your builds on Google Cloud infrastructure. Cloud Build can import source code from Google Cloud Storage, Cloud Source Repositories, execute a build to your specifications, and produce artifacts such as Docker containers or Java archives.
Build configuration overview¶
In order to trigger a build, it is necessary to pass the build configuration.
airflow/providers/google/cloud/example_dags/example_cloud_build.py
The source code for the build can come from Google Cloud Build Storage:
It is also possible to specify it using the URL:
In addition, a build can refer to source stored in Google Cloud Source Repositories.
It is also possible to specify it using the URL:
It is also possible to specify it using a YAML or JSON format.
airflow/providers/google/cloud/example_dags/example_cloud_build.py
Read Build Configuration Overview to understand all the fields you can include in a build config file.
Trigger a build¶
Trigger a build is performed with the
CloudBuildCreateBuildOperator
operator.
airflow/providers/google/cloud/example_dags/example_cloud_build.py
You can use Jinja templating with
body
, gcp_conn_id
, api_version
, impersonation_chain
parameters which allows you to dynamically determine values. The result is saved to XCom, which allows it
to be used by other operators.