fix(gcp-metadata): detect Cloud Run worker pools as serverless - #9331
LucasLeao18 wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request updates the isGoogleCloudServerless function in gcp-residency.ts to include the CLOUD_RUN_WORKER_POOL environment variable when detecting if the application is running in a Google Cloud Serverless environment. It also adds corresponding unit tests and updates the test utility to clean up this environment variable. There are no review comments, and I have no feedback to provide.
Problema
isGoogleCloudServerless()(gcp-metadata) não reconhece Cloud Run Worker Pools: só checaCLOUD_RUN_JOB,FUNCTION_NAMEeK_SERVICE. Com apenasCLOUD_RUN_WORKER_POOLsetado, retornafalsequando deveria retornartrue. Inclui reprodução mínima na issue.Solução
core/packages/gcp-metadata/src/gcp-residency.ts: adicionaprocess.env.CLOUD_RUN_WORKER_POOLà checagem, com comentário/doc-link no padrão existente.test/utils/gcp-residency.ts: inclui a nova variável emremoveServerlessEnvironmentVariables()para manter o helper consistente.test/gcp-residency.test.ts: novo casoshould return true if CLOUD_RUN_WORKER_POOL env is set.Validação
npm run compile(tsc) limpo.isGoogleCloudServerless()retornatrue.Referência
Fixes #9225