You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "tnk-ysk (via GitHub)" <gi...@apache.org> on 2023/03/03 19:05:42 UTC

[GitHub] [airflow] tnk-ysk commented on a diff in pull request #29689: Add location to CloudBuildCreateBuildOperator

tnk-ysk commented on code in PR #29689:
URL: https://github.com/apache/airflow/pull/29689#discussion_r1124902895


##########
airflow/providers/google/cloud/hooks/cloud_build.py:
##########
@@ -158,13 +159,17 @@ def create_build_without_waiting_for_result(
         :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.
+        :param location: Optional, The location of the project.
+            If set to None or missing, global is used.

Review Comment:
   @uranusjr 
   CloudBuild locations have global (non-regional) apart from general regions.
   The current operator can only create builds on global which is the default.
   This PR is to be able to change that.
   
   https://cloud.google.com/sdk/gcloud/reference/builds/submit
   ```
   --region=REGION
   The region of the Cloud Build Service to use.
   Must be set to a supported region name (e.g. us-central1).
   If unset, builds/region, which is the default region to use when working with Cloud Build resources, is used.
   If builds/region is unset, region is set to global.
   ```
   
   However, when I actually specified the location with python client and tried to [create_build](https://cloud.google.com/python/docs/reference/cloudbuild/latest/google.cloud.devtools.cloudbuild_v1.services.cloud_build.CloudBuildClient#google_cloud_devtools_cloudbuild_v1_services_cloud_build_CloudBuildClient_create_build), an error occurred and I could not change it.
   ```
   google.api_core.exceptions.InvalidArgument: 400 generic::invalid_argument: invalid value for 'parent': location "us-central1" is unsupported, service location is "global"
   ```
   
   I also tried [list_builds 'parent'](https://github.com/apache/airflow/blob/f0bd45389c7799884a26d2b9c79b0498683d3e03/airflow/providers/google/cloud/hooks/cloud_build.py#L455) used in CloudBuildListBuildsOperator , but the global one was returned and didn't seem to work.
   
   I am contacting GCP support about this issue.
   Please wait for a while until the reply comes.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org