Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Get project id from google.auth.default() in empty GcpCredentials block if quota project is None #219

Merged
merged 4 commits into from
Oct 17, 2023

Conversation

kevingrismore
Copy link
Contributor

Adds a check to GcpCredentials block initialization to acquire the GCP project id from google.auth.default() if no quota_project_id exists. This scenario arises when initializing an empty block on compute in Cloud Run, Compute Engine, or App Engine in which gcloud auth application-default login has not been run. Enables Cloud Run workers on compute with an attached service account and the correct roles to start Cloud Run jobs without requiring a completed GCP Credentials block to be added to the connected work pool.

Example

Screenshots

Checklist

  • References any related issue by including "Closes #" or "Closes ".
    • If no issue exists and your change is not a small fix, please create an issue first.
  • Includes tests or only affects documentation.
  • Passes pre-commit checks.
    • Run pre-commit install && pre-commit run --all locally for formatting and linting.
  • Includes screenshots of documentation updates.
    • Run mkdocs serve view documentation locally.
  • Summarizes PR's changes in CHANGELOG.md

@kevingrismore kevingrismore requested a review from a team as a code owner October 16, 2023 19:30
@desertaxle
Copy link
Member

Thanks for the PR @kevingrismore! Could you please write a test covering the new condition? Let me know if you need any help!

@kevingrismore
Copy link
Contributor Author

@desertaxle Added a test, but I haven't worked with MagicMock before so I tried to model it after an existing test. Open to any recommendations for improvement!

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@desertaxle desertaxle merged commit d319d8a into main Oct 17, 2023
10 checks passed
@desertaxle desertaxle deleted the fix-credentials-project-inference branch October 17, 2023 17:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants