我正在按照文档获取 Slack 机器人,以使用在Google Cloud Builder Community中找到的 Slack 图像报告 Google Cloud Platform 中项目的 Cloud Build 进度。我已经能够成功发布开箱即用的消息。由于我有多个要构建的存储库,因此我想发布正在构建的存储库的名称:例如Build bot: Repo Fizz-buzz built successfully...Build bot: Repo Wizz-bang failed to build...在Notify()函数中,cloudbuild.Build结构有一些属性可以做我想要的。看起来很理想,Source.RepoSource.RepoName但它是零。另一种选择是让trigger()函数添加存储库名称作为参数:Args: []string{ fmt.Sprintf("--build=%s", build), fmt.Sprintf("--webhook=%s", webhook), fmt.Sprintf("--repoName=%s", repoName), "--mode=monitor", },我宁愿让 Notify() 函数处理这个问题,但我还没有找到合适的结构属性。是否有我可以在notify()函数期间使用的属性来传递存储库名称?
- 1 回答
- 0 关注
- 108 浏览
添加回答
举报
0/150
提交
取消