Skip to content

feat(cli): accept dynamic GCP project ID from env var during secrets fetch#545

Merged
Aaron ("AJ") Steers (aaronsteers) merged 6 commits intomainfrom
aj/feat/cli/accept-dynamic-gcp-project-id-from-env-var
May 16, 2025
Merged

feat(cli): accept dynamic GCP project ID from env var during secrets fetch#545
Aaron ("AJ") Steers (aaronsteers) merged 6 commits intomainfrom
aj/feat/cli/accept-dynamic-gcp-project-id-from-env-var

Conversation

@aaronsteers
Copy link
Copy Markdown
Member

@aaronsteers Aaron ("AJ") Steers (aaronsteers) commented May 15, 2025

This does a few things:

First, this sets us up to support community-provided "BYO" creds as related to here:

By setting an env var for GCP_PROJECT_ID (non-sensitive) along with GCP_GSM_CREDENTIALS (secret), partners and community members can enable integration tests to run in their own forks, without intervention from Airbyte and without needing Airbyte approval for their workflows to run.

Also included: this drive-by fix:

  • Resolve a missed update to the secrets list CLI, which is to accept a CONNECTOR positional arg, rather than requiring --connector-name or --connector-directory to be set. This brings this CLI command into parity with the other recent updates to secrets fetch, connector test, and others.

Summary by CodeRabbit

  • New Features

    • The CLI now allows specifying the GCP project ID via an environment variable, providing more flexibility in configuration.
  • Improvements

    • The list and fetch commands now accept a single optional positional argument to specify the connector by name or path, simplifying usage.
    • Updated help texts and documentation for CLI commands to clarify new behaviors and argument options.

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

@aaronsteers Aaron ("AJ") Steers (aaronsteers) changed the title feat(cli): accept dynamic gcp project ID from env var during secrets fetch feat(cli): accept dynamic GCP project ID from env var during secrets fetch May 15, 2025
@github-actions github-actions bot added the enhancement New feature or request label May 15, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces dynamic configuration for the GCP project ID by allowing it to be set via an environment variable for integration tests while also simplifying the CLI command for listing secrets by replacing the separate connector options with a single, optional positional argument.

  • Add support for dynamic GCP project ID configuration using the "GCP_PROJECT_ID" env var.
  • Update CLI options and help text for both "fetch" and "list" commands to align with recent improvements.
  • Replace the dual connector flags with one positional argument in the "secrets list" command.
Comments suppressed due to low confidence (1)

airbyte_cdk/cli/airbyte_cdk/_secrets.py:90

  • [nitpick] Consider updating the help text to state that if the GCP_PROJECT_ID environment variable is not set, the default value 'dataline-integration-testing' will be used.
Default to the value of the `GCP_PROJECT_ID` environment variable, if set.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 15, 2025

📝 Walkthrough

"""

Walkthrough

The changes update the handling of the GCP project ID by replacing a hardcoded constant with an environment-variable-driven value. The CLI commands for fetching and listing secrets now use a single optional positional argument for connector identification, and related docstrings and parameter defaults are revised to reflect this new behavior.

Changes

File(s) Change Summary
airbyte_cdk/cli/airbyte_cdk/_secrets.py - Replaced AIRBYTE_INTERNAL_GCP_PROJECT with GCP_PROJECT_ID sourced from environment or default.
- Updated CLI commands (fetch, list_) to use a single optional positional connector argument instead of separate name and directory options.
- Enhanced docstrings to clarify connector argument behavior.
- Updated help text and parameter defaults for GCP project ID.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Env
    participant GCP

    User->>CLI: Run 'fetch' or 'list' command [optional CONNECTOR]
    CLI->>Env: Read GCP_PROJECT_ID env var
    Env-->>CLI: Return value or None
    CLI->>CLI: Set GCP_PROJECT_ID (env or default)
    CLI->>CLI: Resolve connector name and directory from argument
    CLI->>GCP: Fetch or list secrets using GCP_PROJECT_ID and connector info
    GCP-->>CLI: Return secrets data
    CLI-->>User: Output secrets
Loading

Would you like to see a more detailed breakdown of the connector resolution logic in a separate diagram, or is this overview sufficient for your needs? Wdyt?
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between a606911 and 39738d2.

📒 Files selected for processing (1)
  • airbyte_cdk/cli/airbyte_cdk/_secrets.py (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • airbyte_cdk/cli/airbyte_cdk/_secrets.py
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: SDM Docker Image Build
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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.

@aaronsteers
Copy link
Copy Markdown
Member Author

Aaron ("AJ") Steers (aaronsteers) commented May 16, 2025

Logging here:

I successfully tested this locally using the following method.

  1. poetry run which airbyte-cdk to get an absolute path to the CDK CLI within the Poetry venv.
  2. cd ../airbyte/airbyte-integrations/connectors/destination-duckdb so I'm in a connector directory.
  3. ./big-long-path-to/airbyte-cdk secrets list to confirm secrets list works as expected still after this change.
  4. export GCP_PROJECT_ID=foobar and then re-run the above to confirm that it fails.
  5. export GCP_PROJECT_ID=dataline-integration-testing and then re-run the above to confirm that it succeeds.

Comment thread airbyte_cdk/cli/airbyte_cdk/_secrets.py
Copy link
Copy Markdown
Contributor

@dbgold17 David Gold (dbgold17) left a comment

Choose a reason for hiding this comment

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

LGTM, one comment

Comment thread airbyte_cdk/cli/airbyte_cdk/_secrets.py Outdated
@aaronsteers Aaron ("AJ") Steers (aaronsteers) merged commit 6485afd into main May 16, 2025
27 of 29 checks passed
@aaronsteers Aaron ("AJ") Steers (aaronsteers) deleted the aj/feat/cli/accept-dynamic-gcp-project-id-from-env-var branch May 16, 2025 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants