英文:
How do I pull the status from a the latest cloud build run, from a specific build trigger?
问题
以下是您要翻译的内容:
这个项目的最终目标是检查在Airflow中特定云构建触发器的最新运行状态。
然而,我无法列出单个构建,或者获取项目中触发器的列表等等。
在Google文档中的所有示例似乎对我都不起作用。例如,从我的项目中获取触发器列表:
from google.cloud.devtools import cloudbuild_v1
def sample_list_build_triggers():
# 创建客户端
client = cloudbuild_v1.CloudBuildClient()
# 初始化请求参数
request = cloudbuild_v1.ListBuildTriggersRequest(
project_id="example_project_id",
)
# 发送请求
page_result = client.list_build_triggers(request=request)
# 处理响应
for response in page_result:
print(response)
sample_list_build_triggers()
这返回了None,尽管肯定存在触发器。我在这里使用的project_id与云构建的“执行详细信息”选项卡中的相同。文档确实说明了API是实验性的。但也许我漏掉了什么?这很困难,因为我尝试的每一种方法都会悄无声息地失败,似乎没有办法在这里进行错误测试。
我还参考了这个问题。这是上面Google文档中显示的相同示例,但不起作用。
是否有检索云构建运行状态的替代方法?或者关于如何进行测试的任何建议?我已经设置了我的CloudBuild触发器通过Pub/Sub消息触发,但不确定如何检测它何时成功运行。也许这可以作为一个潜在的解决方法。
感谢任何帮助。
英文:
The end goal of this project is to check the status of the latest run from a specific cloud build trigger in airflow.
However, I'm unable to list a single build, or pull a list of triggers in my project, etc.
None of the examples in the google docs appear to be working for me. For example, pulling a list of triggers from my project:
from google.cloud.devtools import cloudbuild_v1
def sample_list_build_triggers():
# Create a client
client = cloudbuild_v1.CloudBuildClient()
# Initialize request argument(s)
request = cloudbuild_v1.ListBuildTriggersRequest(
project_id="example_project_id",
)
# Make the request
page_result = client.list_build_triggers(request=request)
# Handle the response
for response in page_result:
print(response)
sample_list_build_triggers()
This returns None, when there are certainly triggers. The project_id I use here is the exact same as the one from a cloud build's 'execution details' tab. The docs do state that the API is experimental. But perhaps I am missing something? It's quite hard as everything I try silently fails, and there doesn't seem to be a way to error test here.
I have also referenced this question. This is the same example from the google docs shown above that is not working.
Is there an alternative method to retrieving the status of a cloud build run? Or any advice on how to go about testing? I have my CloudBuild trigger being set off by a pubsub message, but I'm not sure how to detect when it runs successfully. Perhaps this could be a potential workaround.
Thanks for any help.
答案1
得分: 1
自文档中提到,该API仍处于实验阶段。
在使用过程中可能会遇到错误和问题,这将属于Pre-GA Offerings Terms的范畴。
Pre-GA Offerings Terms. Google 可能向客户提供尚未列在 https://cloud.google.com/terms/services 或在相关文档或材料中标记为“早期访问”、“Alpha”、“Beta”、“Preview”、“Experimental”或类似称号的 Google Cloud 平台功能、服务或软件(统称为“Pre-GA Offerings”)。虽然 Pre-GA Offerings 不是服务或软件,但客户使用 Pre-GA Offerings 受适用于服务(或软件,如果适用)的协议条款的约束,该协议条款经过第 5 条的修订。
接下来,我建议您在问题跟踪系统和产品功能请求下提交错误报告。
免责声明:
这没有具体的预计完成时间,但您可以在创建错误报告后跟踪其进展。
英文:
Since the documentation stated that the API is still in experimental.
You may encounter bugs and errors along the way this would fall under the Pre-GA Offerings Terms.
> Pre-GA Offerings Terms. Google may make available to Customer pre-general availability Google Cloud Platform features, services or software that are either not yet listed at https://cloud.google.com/terms/services or identified as “Early Access,” “Alpha,” “Beta,” “Preview,” “Experimental,” or a similar designation in related documentation or materials (collectively, “Pre-GA Offerings”). While Pre-GA Offerings are not Services or Software, Customer’s use of Pre-GA Offerings is subject to the terms of the Agreement applicable to Services (or Software, if applicable), as amended by this Section 5.
The next thing I would suggest is to file a bug under the Issue tracking system and product feature request.
Disclaimer:
This doesn't have a specific ETA but you can keep track of its progress once you create the bug.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论