Skip to content

Skip cloud credential method when NO_GCE_CHECK=true#803

Open
0x2b3bfa0 wants to merge 1 commit intofsspec:mainfrom
0x2b3bfa0:skip-cloud-on-no-gce-check
Open

Skip cloud credential method when NO_GCE_CHECK=true#803
0x2b3bfa0 wants to merge 1 commit intofsspec:mainfrom
0x2b3bfa0:skip-cloud-on-no-gce-check

Conversation

@0x2b3bfa0
Copy link
Copy Markdown

@0x2b3bfa0 0x2b3bfa0 commented Apr 3, 2026

For consistency with googleapis/google-auth-library-python#1610, see fsspec/filesystem_spec#1768 for context.

Summary

  • When auto-detecting credentials (method=None), skip the "cloud" method if the NO_GCE_CHECK environment variable is set to "true"
  • Avoids unnecessary GCE metadata server requests in environments where GCE is known to be unavailable
  • Only affects the auto-detection path; explicit token="cloud" still works

Test plan

  • Added test_no_gce_check_skips_cloud to verify _connect_cloud is not called when NO_GCE_CHECK=true
  • Existing credential tests still pass

🤖 Generated with Claude Code

When auto-detecting credentials (method=None), skip the "cloud"
method if the NO_GCE_CHECK environment variable is set to "true".
This avoids unnecessary metadata server requests in environments
where GCE is known to be unavailable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@0x2b3bfa0 0x2b3bfa0 changed the title Skip cloud credential method when NO_GCE_CHECK=true Skip cloud credential method when NO_GCE_CHECK=true Apr 3, 2026
@martindurant
Copy link
Copy Markdown
Member

While this clearly gives the option to skip the slow creds step, if a user knows to pass this environment variable, then they probably should know which of the credentials types they need, no?

@0x2b3bfa0
Copy link
Copy Markdown
Author

if a user knows to pass this environment variable, then they probably should know which of the credentials types they need, no?

Indeed! However, there might be cases where the choice of enabling this environment variable isn't up to the user, but up to the platform running the user's code, or to some intermediary library. 🫣

@martindurant
Copy link
Copy Markdown
Member

Fair enough. @ankitaluthra1 , any thoughts on yet-another-envvar? Perhaps this can be a simple keyword argument (in init), so it can be set via the fsspec config system?

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.34%. Comparing base (e70bc65) to head (0ecaefb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #803      +/-   ##
==========================================
+ Coverage   75.98%   76.34%   +0.36%     
==========================================
  Files          14       14              
  Lines        2665     2668       +3     
==========================================
+ Hits         2025     2037      +12     
+ Misses        640      631       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants