推送后如何使用 BitBucket 管道更新 Google Cloud Compute Engine 实例?

How to use BitBucket Pipelines to update Google Cloud Compute Engine instance after a push?

我看过有关如何使用 App Engine 完成此操作的文档,但没有关于 Compute Engine 的文档。谢谢!

您可以使用 Cloud Deployment Manager API 编写 Compute Engine 应用程序。 https://cloud.google.com/deployment-manager

此 Atlassian 博客 "bitbucket-pipelines.yml" 文件的最后一行 post 是 "gcloud app deploy",用于更新 App Engine 应用程序。 https://confluence.atlassian.com/bitbucket/deploy-to-google-cloud-900820342.html

# Deploying the application
- gcloud -q app deploy app.yaml

对于 Deployment Manager API,使用 "gcloud deployment-manager deployments update"。 https://cloud.google.com/sdk/gcloud/reference/deployment-manager/deployments/update

例如:

# Deploying the application
- gcloud -q deployment-manager deployments update my-deployment --config config.yaml

我建议您查看将 Deployment Manager API 与 CI/CD 管道结合使用的最佳实践。 https://cloud.google.com/deployment-manager/docs/best-practices/#continuous_integration_ci_continuous_deployment_cd