Google cloud platform Google Cloud Builder-如何在子目录中触发构建配置?
我正在尝试建立一个GoogleCloudBuilder构建触发器来自动构建并将我的应用部署到GoogleAppEngine 使用电流: 我已经使用Google cloud platform Google Cloud Builder-如何在子目录中触发构建配置?,google-cloud-platform,google-cloud-build,Google Cloud Platform,Google Cloud Build,我正在尝试建立一个GoogleCloudBuilder构建触发器来自动构建并将我的应用部署到GoogleAppEngine 使用电流: 我已经使用cloudbuildlocal工具测试了本地构建工作 这两种方法在当地奏效: 从应用程序子目录:云构建本地--config=cloudbuild.yaml--dryrun=false。 从存储库根目录:云构建本地--config=clearbooks rest aspnetcore/cloudbuild.yaml--dryrun=false clear
cloudbuildlocal
工具测试了本地构建工作
这两种方法在当地奏效:
云构建本地--config=cloudbuild.yaml--dryrun=false。
云构建本地--config=clearbooks rest aspnetcore/cloudbuild.yaml--dryrun=false clearbooks rest aspnetcore
如何配置Cloud Builder以在存储库的子目录中启动构建?解决方案是更新
cloudbuild.yaml
:
dir:
选项app.yaml
位置steps:
- name: 'gcr.io/cloud-builders/dotnet'
args: [ 'publish', '-c', 'Release' ]
dir: 'clearbooks-rest-aspnetcore'
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app','deploy','clearbooks-rest-aspnetcore/bin/Release/netcoreapp2.1/publish/app.yaml']
在本地测试时,请在存储库根目录上运行cloud build local
,而不要在app子目录上运行:
cloudbuildlocal--config=clearbooks rest-aspnetcore/cloudbuild.yaml--dryrun=false。
这反映了云构建的工作方式:
我猜您需要为
--config
@MartinZeitler传递一个绝对路径,我在Build Trigger部分为其传递了绝对路径,但它仍然不起作用,因为它似乎需要源参数来匹配,而Build Trigger definition屏幕却没有显示它。您看到了什么错误消息或错误行为?@JeffreyRennie我现在已经解决了这是通过添加dir:
参数并使用正确的参数进行本地测试来实现的,以反映云构建的工作方式。作为答复张贴。谢谢
steps:
- name: 'gcr.io/cloud-builders/dotnet'
args: [ 'publish', '-c', 'Release' ]
dir: 'clearbooks-rest-aspnetcore'
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app','deploy','clearbooks-rest-aspnetcore/bin/Release/netcoreapp2.1/publish/app.yaml']