一个带有 Angular 的 ASP.NET Core API 项目可以在不到一分钟的时间内在本地机器上构建,但是当我使用 Google Cloud Builder 的 Build Trigger 来自动化这个过程时,它需要很长时间。我将 cloudbuild.yaml 设置如下。该项目使用 .NET Core 2.2 和 Angular。我该怎么做才能让 Cloud Build 再次正常运行?
我试图修改 CloudBuild.yaml 文件,比如增加超时,但这也没有帮助。
这是用于将应用程序部署到 AppEngine Flexible 的 cloudbuild.yaml。它首先安装 Angular 的依赖项,然后构建它,发布 API 并部署应用程序。
steps:
# run npm install for Angular
- name: 'gcr.io/cloud-builders/npm'
args: ['install']
dir: 'PPlus.Web/ClientApp'
# build Angular for production
- name: 'gcr.io/cloud-builders/npm'
args: ['run', 'build','--','--prod']
dir: 'PPlus.Web/ClientApp'
# publish asp.net core solution
- name: microsoft/dotnet:2.2-sdk
args: ['dotnet', 'publish','-c','Release']
# deploy the webapi to the AppEngine
- name: gcr.io/cloud-builders/gcloud
args: ['app', 'deploy',
'./PPlus.Web/bin/Release/netcoreapp2.2/publish/app.yaml','--version','staging']
timeout: 1800s
由于在本地构建它需要几秒钟,因此使用 Cloud Builder 应该不会超过几分钟。
Cloud Build 的日志只显示一条消息指示超时,但我越增加超时限制,越需要时间没有完成。