Repository navigation
[management] chores: fix lint error on google workspace - #5907
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughCredentials handling for the Google Workspace manager was refactored to return a Google SDK Changes
Sequence Diagram(s)sequenceDiagram
participant Manager as Manager
participant ServiceAccount as ServiceAccount
participant DefaultCreds as DefaultCreds
participant GoogleAdminSDK as GoogleAdminSDK
Manager->>ServiceAccount: read ServiceAccountKey (base64)
alt key present
ServiceAccount-->>Manager: decoded JSON
Manager->>GoogleAdminSDK: option.WithAuthCredentialsJSON(decoded)
else key empty
Manager->>DefaultCreds: google.FindDefaultCredentials(ctx, scope)
DefaultCreds-->>Manager: creds
Manager->>GoogleAdminSDK: option.WithCredentials(creds)
end
GoogleAdminSDK-->>Manager: client ready
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
management/server/idp/google_workspace.go (1)
69-76: Use the caller context consistently during Google service construction.
getGoogleCredentialsOptionnow correctly usesctx, butadmin.NewServicestill receivescontext.Background(). Preferctxhere to preserve cancellation/deadline behavior from callers.♻️ Proposed change
- service, err := admin.NewService(context.Background(), + service, err := admin.NewService(ctx, option.WithScopes(admin.AdminDirectoryUserReadonlyScope), credentialsOption, )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@management/server/idp/google_workspace.go` around lines 69 - 76, The admin.NewService call is using context.Background() which breaks caller cancellation/deadline propagation; replace context.Background() with the passed ctx so the caller's context is used when constructing the Google service. Locate the block around getGoogleCredentialsOption(...) and the admin.NewService(...) call (references: getGoogleCredentialsOption, credentialsOption, admin.NewService, config.ServiceAccountKey) and pass ctx into admin.NewService instead of context.Background(), keeping the existing option.WithScopes and credentialsOption arguments unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@management/server/idp/google_workspace.go`:
- Around line 232-233: Replace uses of
option.WithAuthCredentialsJSON(option.ServiceAccount, decodeKey) with
option.WithCredentialsJSON(decodeKey) because the pinned google API version
exposes WithCredentialsJSON([]byte) not WithAuthCredentialsJSON; update every
location (e.g., the call inside the function that checks len(decodeKey) and any
similar occurrences) to pass the raw []byte decodeKey to
option.WithCredentialsJSON and remove the option.ServiceAccount argument.
---
Nitpick comments:
In `@management/server/idp/google_workspace.go`:
- Around line 69-76: The admin.NewService call is using context.Background()
which breaks caller cancellation/deadline propagation; replace
context.Background() with the passed ctx so the caller's context is used when
constructing the Google service. Locate the block around
getGoogleCredentialsOption(...) and the admin.NewService(...) call (references:
getGoogleCredentialsOption, credentialsOption, admin.NewService,
config.ServiceAccountKey) and pass ctx into admin.NewService instead of
context.Background(), keeping the existing option.WithScopes and
credentialsOption arguments unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 982834a2-3369-46e8-8a8b-861d7ffb723f
📒 Files selected for processing (1)
management/server/idp/google_workspace.go
|



Describe your changes
Fix deprecated function on google workspace to make linter pass
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit