Skip to content

chore: use sdm cli as dockerfile entrypoint #470

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ChristoGrab
Copy link
Collaborator

@ChristoGrab ChristoGrab commented Apr 10, 2025

What

Small updates to the python CDK's dockerfile to use the source-declarative-manifest cli as the entrypoint rather than running the code via python call.

Resolves #11698

Summary by CodeRabbit

  • Documentation

    • Added a comprehensive README for the CLI tool, including installation, usage instructions, and local testing guidance.
  • Chores

    • Updated container startup to use the CLI tool as the entrypoint instead of the Python script.
    • Improved Dockerfile comments for clarity on package installation.

@github-actions github-actions bot added the chore label Apr 10, 2025
@ChristoGrab ChristoGrab marked this pull request as ready for review April 22, 2025 16:15
@ChristoGrab ChristoGrab requested a review from aaronsteers April 22, 2025 16:16
Copy link
Contributor

coderabbitai bot commented Apr 22, 2025

📝 Walkthrough

Walkthrough

This update modifies the Dockerfile to change how the source-declarative-manifest CLI is installed and invoked at container startup. The entrypoint is switched from running a Python script directly to invoking the CLI executable. Additionally, a new README file is added for the CLI, providing installation, usage, and local development instructions, including examples for embedding manifests in configuration files for local testing.

Changes

File(s) Change Summary
Dockerfile Updated comments for clarity, retained pip install, and changed the entrypoint to run the CLI executable instead of the Python script.
airbyte_cdk/cli/README.md Added a new README with installation, usage, and local development instructions for the CLI tool.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DockerContainer
    participant source-declarative-manifest CLI

    User->>DockerContainer: Start container
    DockerContainer->>source-declarative-manifest CLI: Invoke CLI entrypoint
    source-declarative-manifest CLI->>source-declarative-manifest CLI: Execute command (spec/check/discover/read)
Loading

Possibly related PRs

Suggested labels

docs

Suggested reviewers

  • natikgadzhi

Would you like to further clarify the README with additional troubleshooting steps for other common environments, or is the current guidance sufficient, wdyt?


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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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
Contributor

@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: 1

🧹 Nitpick comments (6)
Dockerfile (2)

20-22: Optimize pip install to reduce image size?

Right now we run:

RUN pip install dist/*.whl

Would you consider adding --no-cache-dir to prevent wheel caching and keep the image slimmer, e.g.:

RUN pip install --no-cache-dir dist/*.whl

wdyt?


36-38: Remove or leverage the AIRBYTE_ENTRYPOINT env var?

I see we set:

ENV AIRBYTE_ENTRYPOINT="source-declarative-manifest"
ENTRYPOINT ["source-declarative-manifest"]

Should we either drop the unused AIRBYTE_ENTRYPOINT variable or switch to a shell form entrypoint that references it, so it’s single-source-of-truth? wdyt?

airbyte_cdk/cli/README.md (4)

5-17: Add an offline YAML→JSON option?

You suggest an online tool for converting manifests, but many devs prefer local tooling. Could we mention a yq example, e.g.:

yq eval -o=json manifest.yaml > manifest.json

wdyt?


19-32: Expand examples for all commands?

Listing spec, check, discover, and read is helpful. Could we include short CLI snippets for spec and discover here as well, so users see full usage at a glance? wdyt?


38-44: Clarify step sequencing and placeholders

Step 1 covers conversion nicely. Maybe call out that the JSON must be valid (no comments) and note the placeholder will need removal. Also reiterate the yq alternative here? wdyt?


57-63: Include local spec and discover examples too?

You show check and read for local tests—nice! Could we also demonstrate spec and discover in the same section, so the guide covers all CLI commands? wdyt?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b148ca5 and 878c749.

📒 Files selected for processing (2)
  • Dockerfile (2 hunks)
  • airbyte_cdk/cli/README.md (1 hunks)
🔇 Additional comments (2)
airbyte_cdk/cli/README.md (2)

1-4: Great CLI introduction

The title and opening lines clearly explain the purpose of this guide—nice work!


34-37: Local dev caution looks solid

The "remote manifest mode" note is clear and very useful for people hacking locally.

Comment on lines +46 to +56
Example:

```json
{
"api_key": "very_secret_key",
"start_time": "04:20",
"__injected_declarative_manifest": {
// Insert the JSON version of your manifest here
}
}
```
Copy link
Contributor

@coderabbitai coderabbitai bot Apr 22, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

JSON snippet contains invalid comments

JSON doesn’t support // comments, which will break parsing. Should we replace the inline comment with a placeholder or remove it entirely? For example:

-  "__injected_declarative_manifest": {
-    // Insert the JSON version of your manifest here
-  }
+  "__injected_declarative_manifest": { /* insert your manifest JSON here */ }

wdyt?

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@coderabbitai Oh nice! I wasn't aware of that placeholder pattern, please go ahead and make this change.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ChristoGrab Great! I'll plan that change for you now. The JSON comment will be updated to use the proper format:

%%{init: {"securityLevel":"loose"}}%%
flowchart TB
    A["Fix JSON comment in README"] --> B["Replace // style comment with /* */ style"]
Loading

Another agent will execute this change for you shortly. This will ensure that the example JSON in the documentation is properly formatted and won't cause parsing errors when copied by users.


⏳ Preparing changes...

Copy link
Contributor

Choose a reason for hiding this comment

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

A summary of the edits CodeRabbit can apply:

We will replace the invalid // comment with a proper /* */ comment in the JSON example in airbyte_cdk/cli/README.md.

A plan of each step that CodeRabbit will take in order to execute the edits for each file (with inline rough draft snippets):

✏️ airbyte_cdk/cli/README.md

Delete lines 51–53 (the opening brace, the // comment line, and the closing brace) and insert a single line:

  "__injected_declarative_manifest": { /* insert your manifest JSON here */ }

Ensure there are two spaces of indentation before "__injected_declarative_manifest" to match the surrounding JSON block, and verify no trailing commas or extra braces are introduced.


Save the file and preview the Markdown rendering to confirm that the JSON block is syntactically valid and that the comment displays correctly in all rendered views.

A summary of the context that CodeRabbit is considering across the codebase:

Locate the JSON snippet containing the invalid // comment in airbyte_cdk/cli/README.md to confirm the exact line numbers to modify.

  • ✅ Create PR with these edits

  • 📋 Get copyable edits

  • 📌 Create commit in current branch

  • 🔄 Try a different approach

  • ⏪ Go back to ordinary chat

Copy link
Contributor

@aaronsteers aaronsteers left a comment

Choose a reason for hiding this comment

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

This looks great, @ChristoGrab . One suggestion regarding docs, non-blocking.

Copy link
Contributor

Choose a reason for hiding this comment

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

@ChristoGrab - If we move this markdown content into the cli/__init__.py docstring, it will automatically render in pdoc when we generate the API docs via GitHub pages. Wdyt?

Copy link
Contributor

@aaronsteers aaronsteers Apr 22, 2025

Choose a reason for hiding this comment

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

I think there's also a syntax to import markdown file into the pdoc generation if you want to keep it a separate file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants