feat: resource autodetection for cloud run#1024
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1024 +/- ##
=======================================
Coverage 97.91% 97.92%
=======================================
Files 18 18
Lines 13160 13190 +30
Branches 399 421 +22
=======================================
+ Hits 12886 12916 +30
Misses 271 271
Partials 3 3
Continue to review full report at Codecov.
|
| // everything runs on top of compute engine. | ||
| return getGCEDescriptor().catch(() => getGlobalDescriptor()); | ||
| // Google Cloud Run | ||
| if (process.env.K_CONFIGURATION) { |
There was a problem hiding this comment.
Is there a reason it doesn't follow a similar pattern as the rest of them? GCPEnv.CLOUD_RUN?
There was a problem hiding this comment.
GCPEnv from google-auth-library detects cloudrun as compute_engine. So I look for the K_CONFIG envvar unique to cloud run within this switch case
Also I just filed issue for this in google-auth-lib here: googleapis/google-auth-library-nodejs#1155
| const K_SERVICE = 'hello-world'; | ||
| const K_REVISION = 'hello-world.1'; | ||
| const K_CONFIGURATION = 'hello-world'; |
There was a problem hiding this comment.
let's make the values similar to actual ones.
There was a problem hiding this comment.
I followed the official documentation on the sample values. https://cloud.google.com/run/docs/reference/container-contract
Fixes #959 🦕
Changes:
nox --python 3.7 --session "tests(language='nodejs', platform=‘cloudrun’)”in/env-tests-loggingGet
Before:

After:
