0

I am trying to automate deployment to a Google Flex App Engine in a bitbucket pipeline.

If I'm deploying via the CLI I can run something like this to run migrations after deployment:

gcloud app instances ssh --quiet --project <MYPROJECT> --version v0-0-1 --container=gaeapp --service <MYSERVICE> -- do-something-after-deploy.sh

However, this prompts me for this:

ED25519 key fingerprint is SHA256:....................
Are you sure you want to continue connecting (yes/no/[fingerprint])? 

It doesn't look like I can use ssh-keyscan to accept the host key. Is there a way to automate the execution of a script on google app engine after deployment?

mikebridge
  • 195
  • 1
  • 2
  • 11
  • I don't think this is possible currently. It *is* available with `gcloud compute ssh`, though: https://cloud.google.com/sdk/gcloud/reference/compute/ssh#--strict-host-key-checking. I set this up to migrate via the cloud sql proxy instead. – mikebridge Mar 04 '21 at 00:22

1 Answers1

-1

If you don't want to be prompted when running a Cloud SDK command you can use the --quiet flag. As shown in the documentation:

--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.
llompalles
  • 109
  • 3
  • But he has already used `--quiet`! – Michael Hampton Mar 03 '21 at 18:03
  • 1
    I think `--quiet` removes the prompts on the gcloud command, but not the ssh command that it executes on the intermediate shell. – mikebridge Mar 04 '21 at 00:21
  • Hi Mike, I missed that. I believe you are right. However I am not sure that your approach is recommended since ssh the instance is meant for [debugging purposes](https://cloud.google.com/appengine/docs/flexible/python/debugging-an-instance) – llompalles Mar 04 '21 at 10:57