![如何在 flex google app engine 上运行后部署脚本(例如自动迁移)?](https://linux22.com/image/764174/%E5%A6%82%E4%BD%95%E5%9C%A8%20flex%20google%20app%20engine%20%E4%B8%8A%E8%BF%90%E8%A1%8C%E5%90%8E%E9%83%A8%E7%BD%B2%E8%84%9A%E6%9C%AC%EF%BC%88%E4%BE%8B%E5%A6%82%E8%87%AA%E5%8A%A8%E8%BF%81%E7%A7%BB%EF%BC%89%EF%BC%9F.png)
我正在尝试通过 bitbucket 管道自动部署到 Google Flex App Engine。
如果我通过 CLI 部署,我可以运行如下命令来在部署后运行迁移:
gcloud app instances ssh --quiet --project <MYPROJECT> --version v0-0-1 --container=gaeapp --service <MYSERVICE> -- do-something-after-deploy.sh
然而,这促使我这样做:
ED25519 key fingerprint is SHA256:....................
Are you sure you want to continue connecting (yes/no/[fingerprint])?
我似乎无法使用 ssh-keyscan 来接受主机密钥。有没有办法在部署后自动在 Google App Engine 上执行脚本?
答案1
如果您不想在运行 Cloud SDK 命令时收到提示,可以使用该--quiet
标志。如下所示文档:
--quiet, -q
Disable all interactive prompts when running gcloud commands. If input is required,
defaults will be used, or an error will be raised. Overrides the default
core/disable_prompts property value for this command invocation. This is equivalent to
setting the environment variable CLOUDSDK_CORE_DISABLE_PROMPTS to 1.