我正在尝试通过 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.