8000 feat: add ingestion key command and update dependencies by noamApps · Pull Request #316 · groundcover-com/cli · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add ingestion key command and update dependencies #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2025

Conversation

noamApps
Copy link
Collaborator
@noamApps noamApps commented Jul 8, 2025
  • Introduced a new command get-ingestion-key to retrieve or create an ingestion key using the Groundcover SDK.
  • Updated Go version in Earthfile and go.mod to 1.24.
  • Added new dependencies including github.com/groundcover-com/groundcover-sdk-go v1.34.0 and various go-openapi packages.
  • Enhanced client functionality with a custom transport to include tenant UUID in requests.

Summary by CodeRabbit

  • New Features

    • Introduced a new CLI command to retrieve or create an ingestion key and display it in the output.
    • Added client functionality to support tenant-specific SDK client creation.
  • Chores

    • Upgraded Go version and several dependencies to newer versions for improved compatibility and performance.
    • Updated build configuration to specify newer base images and explicit tool versions.

- Introduced a new command `get-ingestion-key` to retrieve or create an ingestion key using the Groundcover SDK.
- Updated Go version in Earthfile and go.mod to 1.24.
- Added new dependencies including `github.com/groundcover-com/groundcover-sdk-go` v1.34.0 and various `go-openapi` packages.
- Enhanced client functionality with a custom transport to include tenant UUID in requests.
Copy link
coderabbitai bot commented Jul 8, 2025

Walkthrough

This update introduces a new CLI command to fetch or create ingestion keys, adds a package for tenant-aware Groundcover SDK client creation, and updates dependencies and build configurations to Go 1.24 and newer SDK versions. No changes to existing public APIs; all additions are new features or upgrades.

Changes

File(s) / Area Change Summary
Earthfile Explicitly set Earthly version to 0.8; update Go base image to 1.24-alpine.
go.mod Upgrade Go/toolchain to 1.24; add/upgrade SDK and related dependencies.
cmd/ingestion_key.go Add get-ingestion-key CLI command for fetching/creating ingestion keys; register with Cobra.
pkg/client/client.go New package: tenant-aware SDK client creator, custom HTTP transport, and error type for unimplemented features.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI (get-ingestion-key)
    participant SDKClientFactory
    participant GroundcoverAPI

    User->>CLI (get-ingestion-key): Run command
    CLI (get-ingestion-key)->>SDKClientFactory: Create SDK client (with tenant UUID, token)
    SDKClientFactory->>GroundcoverAPI: Instantiate client (custom transport)
    CLI (get-ingestion-key)->>GroundcoverAPI: List ingestion keys
    alt Key exists
        GroundcoverAPI-->>CLI (get-ingestion-key): Return existing key
    else Key missing
        CLI (get-ingestion-key)->>GroundcoverAPI: Create new ingestion key
        GroundcoverAPI-->>CLI (get-ingestion-key): Return new key
    end
    CLI (get-ingestion-key)-->>User: Print ingestion key
Loading
sequenceDiagram
    participant SDKClientFactory
    participant GroundcoverAPI

    SDKClientFactory->>GroundcoverAPI: NewClient(baseURL, token, backendId, tenantUUID)
    GroundcoverAPI->>GroundcoverAPI: Use custom transport (adds X-Tenant-UUID header)
    GroundcoverAPI-->>SDKClientFactory: Return configured client
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63108fe and 20ecb97.

📒 Files selected for processing (1)
  • cmd/ingestion_key.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/ingestion_key.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: goreleaser
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (actions)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
cmd/ingestion_key.go (2)

74-78: Potential inefficiency in key lookup

The loop searches through all keys even when filtering by name in the API request. The API already filters by name, so this loop should only contain matching keys.

Consider simplifying to:

-	// Look for existing CLI ingestion key
-	for _, key := range existingKeys.Payload {
-		if key.Name == CLI_INGESTION_KEY_NAME {
-			return key.Key, nil
-		}
-	}
+	// Return the first key if any exist (API already filtered by name)
+	if len(existingKeys.Payload) > 0 {
+		return existingKeys.Payload[0].Key, nil
+	}

25-27: Consider more descriptive command details

The command name and short description are identical. Consider enhancing usability.

-	Use:   "get-ingestion-key",
-	Short: "get-ingestion-key",
+	Use:   "get-ingestion-key",
+	Short: "Retrieve or create a CLI ingestion key",
pkg/client/client.go (1)

75-82: NotImplementedError appears unused

This error type is defined but not used in the current implementation.

Consider removing if not needed, or document its intended usage.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e37851a and 63108fe.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • Earthfile (1 hunks)
  • cmd/ingestion_key.go (1 hunks)
  • go.mod (6 hunks)
  • pkg/client/client.go (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
cmd/ingestion_key.go (5)
pkg/api/tenant.go (1)
  • TenantInfo (20-24)
pkg/auth/auth0.go (2)
  • Auth0Token (20-25)
  • LoadAuth0Token (39-59)
pkg/client/client.go (1)
  • NewDefaultClient (63-66)
pkg/ui/writer.go (1)
  • QuietWriter (38-38)
cmd/auth.go (1)
  • AuthCmd (7-10)
pkg/client/client.go (1)
pkg/api/client.go (1)
  • NewClient (33-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: goreleaser
  • GitHub Check: Analyze (go)
🔇 Additional comments (5)
Earthfile (2)

1-1: Good practice adding explicit VERSION specification

Adding the VERSION directive improves build reproducibility.


4-4: No explicit Go version constraints detected

We checked:
• Docker base: golang:1.24-alpine
• go.mod: no go X.Y directive found

Next steps:
– Confirm your CI/workflows pull Go 1.24
– Audit all third-party modules for 1.24 compatibility
– Run full test/build on the new image

cmd/ingestion_key.go (1)

24-60: Command implementation looks solid

Good error handling patterns and proper integration with existing auth/tenant systems.

go.mod (1)

3-5: Go version upgrade looks good

The version update from 1.22.0 to 1.24.0 aligns with the Earthfile changes.

pkg/client/client.go (1)

17-28: Custom transport implementation is solid

Good implementation of http.RoundTripper with proper header injection.

- Updated the `get-ingestion-key` command to require an ingestion key type as an argument.
- Modified the `getOrCreateIngestionKey` function to use the provided key type for generating the ingestion key name.
- Improved error h
8000
andling to ensure the key type is specified before proceeding.
Copy link
Contributor
@AvitalTamir AvitalTamir left a comment

Choose a reason for hiding this comment

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

Minor comment, otherwise looks good!

@noamApps noamApps merged commit 8991381 into main Jul 9, 2025
5 checks passed
@noamApps noamApps deleted the noam/core-5552-cli-should-use-new-ingestion-keys branch July 9, 2025 13:10
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
0