鉴于我有一个包含多个服务的 NX 应用程序,并且我想只将受影响的服务持续部署到 App Engine,我如何指向给定的 service.yaml(或多个)在项目的通用 cloudbuild.yaml 中?
monorepo 中的每个服务都有自己的 service.yaml 描述 here
前任:
我的 cloudbuild.yaml 看起来像:
steps:
- name: node
entrypoint: npm
args: ['install']
- name: node
entrypoint: npm
args: ['run', 'affected:build']
- name: 'gcr.io/cloud-builders/gcloud'
args: ['app', 'deploy', 'dist/apps/express-app-1/service.yaml']
timeout: '1600s'
在我的代码中,我指向特定的硬编码服务,但我需要它依赖于 nx affected:build
。
有没有办法做到这一点,并通过 nx build:affected
和 Cloud Build 触发器实现持续部署?
最佳答案
到目前为止,据我所知,还没有标准化或“官方的 NX”方式来做这些事情。
看看这里 discussion .到目前为止,这是我为自己找到的最佳“答案”...
也许是一个快速简单的提示:
您可以使用 print-affected
的输出在您的 CI 中,以便决定需要构建/部署哪些应用。
npx nx print-affected --type=app --select=projects
https://stackoverflow.com/questions/63529228/