【发布时间】:2020-06-16 17:59:52
【问题描述】:
我正在尝试为我的谷歌云功能构建 CI/CD 管道。 我知道的是,我有 gcloud 和 git 的本地开发环境。 我在本地环境中编写代码并拥有 cloudbuilds.yaml 文件。 编写代码后,我将其推送到 Google Source Repository,在那里我有 Build Trigger。 它构建函数并部署它。
现在我也想要一些测试文件。这意味着每当我将它推送到源存储库时,它也应该运行测试并构建我的 main.py 文件,然后部署它。 我拥有的 cloudbuild.yaml 文件是
steps:
- name: 'gcr.io/cloud-builders/gcloud'
args:
- functions
- deploy
- FunctionName
- --runtime=python37
- --source=.
- --entry-point=function
- --trigger-topic=topic_name
- --region=europe-west3
【问题讨论】:
-
你想在部署之前添加单元测试,不是吗?如果测试失败,就不会进行部署,对吧?
-
是的,没错! @guilaume
标签: google-cloud-functions gcloud google-cloud-build google-source-repositories