google-cloud-python icon indicating copy to clipboard operation
google-cloud-python copied to clipboard

projects.locations.builds/get support

Open zach-withcoherence opened this issue 2 years ago • 2 comments

I am able to request the status of a build using both the name and id parameters if the build region is global, such as https://console.cloud.google.com/cloud-build/builds;region=global/617330ef-31db-48e9-ab08-09c92113cbb9?project=coherence-controlplane.

I believe that I need to be using the method https://cloud.google.com/build/docs/api/reference/rest/v1/projects.locations.builds/get on the Cloud Build API instead of https://cloud.google.com/build/docs/api/reference/rest/v1/projects.builds/get if the location is not global.

The request here is for this library to implement a request supporting the locations.builds api.

Thanks!

zach-withcoherence avatar Mar 17 '23 17:03 zach-withcoherence

I'm going to transfer this issue to the google-cloud-python repository as we are preparing to move the code for google-cloud-build to that repository in the next 1-2 weeks.

parthea avatar Apr 17 '23 16:04 parthea

Hi,

Works for me using this snippet:

>>> from google.cloud.devtools import cloudbuild_v1

>>> project_id="123456789"
>>> location="europe-west1"
>>> build_id="294c4569-f647-4058-8932-9104dca65549"

>>> cloudbuild_v1.CloudBuildClient().get_build(request={"name": f"projects/{project_id}/locations/{location}/builds/{build_id}"}).status
<Status.SUCCESS: 3>

denis-ikomia avatar Dec 14 '23 12:12 denis-ikomia