gcloud cli crashed after successfull image build right before deploy command with error:
2022-09-19T06:05:37.8347067Z Building Container....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................done
2022-09-19T06:05:37.8351347Z failed
2022-09-19T06:05:37.8352361Z Deployment failed
2022-09-19T06:05:37.8839076Z ERROR: gcloud crashed (KeyError): 'images'
2022-09-19T06:05:37.8839690Z
2022-09-19T06:05:37.8840175Z If you would like to report this issue, please run the following command:
2022-09-19T06:05:37.8840690Z gcloud feedback
2022-09-19T06:05:37.8840875Z
2022-09-19T06:05:37.8841213Z To check gcloud for common problems, please run the following command:
2022-09-19T06:05:37.8847153Z gcloud info --run-diagnostics
UPDATED: There were enabled kaniko cache in the separate build script under the user account who run deploy script on the same build machine:
# Enable Kaniko cache to speed up the build
gcloud config set builds/use_kaniko True
gcloud config set builds/kaniko_cache_ttl 672 # 4 weeks
And, it leads to conflict between gcloud run deploy --source and gcloud run deploy --image commands.
Definitely, it is a bug in the Cloud SDK.
Workaround: All commands gcloud run deploy which runs under the same user and the same machine should use --image param in case if kaniko cache is enabled. It is not so hard, just need to split the command gcloud run deploy --source into two separate command:
gcloud builds submit --tag IMAGE_IDgcloud run deploy --image IMAGE_ID