Skip to content

Fix log level and error handling #27

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 6 commits into from
Mar 5, 2025
Merged

Fix log level and error handling #27

merged 6 commits into from
Mar 5, 2025

Conversation

erichlf
Copy link
Owner

@erichlf erichlf commented Mar 5, 2025

This PR fixes some issue with log levels and adds some error handling to creating log files.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced logging behavior with improved error notifications and refined log entry conditions.
  • New Features
    • Introduced a configurable Neovim version for a more efficient build and dependency installation process.
    • Added NeoVim 0.9.0 as a new dependency.
  • Tests
    • Updated the automated workflow to run tests with a single Neovim version and trigger on pull requests only.
  • Documentation
    • Minor formatting adjustments in comments for clarity in the README.

Copy link

coderabbitai bot commented Mar 5, 2025

Walkthrough

This pull request updates the logging behavior in lua/devcontainer-cli/log.lua by reversing the condition for writing log entries and adding error notifications via pcall. String formatting is harmonized by switching to double quotes and removing unnecessary commas. The Dockerfile now accepts a NEOVIM_VERSION argument and consolidates dependency installations without using sudo, streamlining the setup for Neovim and related tools. Additionally, the GitHub Actions workflow has been modified to trigger only on pull requests and run tests with a matrix of Neovim versions.

Changes

File(s) Change Summary
lua/devcontainer-cli/log.lua Reversed logging level condition (from >= to <), wrapped file operations in pcall, added error notifications, updated string formatting (single → double quotes), and removed trailing commas in table entries to standardize code style.
Dockerfile Added ARG NEOVIM_VERSION="stable", restructured dependency installation to remove sudo, consolidated package installations (e.g., apt packages, Neovim download, npm and luarocks installations), set the working directory to /app, and implemented cleanup steps.
.github/workflows/default.yml Updated the trigger to only pull_request events, introduced a strategy matrix for unit tests with Neovim version stable, and revised job names, image build parameters (including imageName, cacheFrom), and added buildArgs specifying the Neovim version.
README.md Added new dependency NeoVim 0.9.0, made minor formatting adjustments in comments related to dotfiles_installCommand and logging level settings.
tests/minimal_init.lua Enhanced Lua environment initialization for Neovim plugins, simplified directory existence check, and optimized cloning command with --depth=1.

Possibly related PRs

  • main #25: The changes in the main PR focus on modifying the logging logic in log.lua, while the retrieved PR alters the logging conditions in the same file, indicating a direct relationship between the two.

Poem

I'm a happy rabbit, hopping through the code,
Logging now flips its tale on a brighter road.
Dependencies set without a sudo hop,
And workflows dance as pull requests pop.
With every tweak and every clean line,
I munch on carrots and celebrate the design!
🥕🐇 Happy coding, one hop at a time!


📜 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 c7fe5fe and d94478e.

📒 Files selected for processing (1)
  • .github/workflows/default.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/default.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: NEOVIM stable

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:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • 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 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

@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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bee227c and dc90162.

📒 Files selected for processing (1)
  • lua/devcontainer-cli/log.lua (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: unit-tests
  • GitHub Check: unit-tests
🔇 Additional comments (8)
lua/devcontainer-cli/log.lua (8)

14-14: Consistent string formatting applied.

Standardizing to double quotes for strings improves consistency throughout the codebase.


32-37: Cleaned up table format by removing trailing commas.

Removing trailing commas in the modes table entries is a good cleanup that maintains Lua syntax correctness while improving code style consistency.


52-52: Consistent string formatting in outfile path.

Changing to double quotes for string formatting maintains consistency with other string formatting in the file.


69-69: Minor format improvement to the round function.

The formatting change to the rounding logic improves readability without changing the functionality.


74-74: Improved select function call formatting.

Minor syntax enhancement for better readability in the loop iteration over variadic arguments.


123-131: Enhanced error handling for log file operations.

Excellent improvement by wrapping the file operations in pcall and adding error notifications when writing to the log file fails. This prevents potential silent failures when log files can't be created or written to.


140-140: Improved string formatting syntax for dynamic function names.

The change to use the format method directly with parentheses is a cleaner approach.


142-142: Simplified variable initialization for variadic arguments.

Creating the passed variable with a cleaner syntax improves code readability.

Copy link

coderabbitai bot commented Mar 5, 2025

Caution

No docstrings were generated.

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: 0

🧹 Nitpick comments (1)
Dockerfile (1)

2-2: Maintain Consistent Comment Formatting
The standalone comment on line 2 appears to have been modified. If its purpose is solely for visual separation, consider either enhancing its content for clarity or removing it to avoid unnecessary clutter.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dc90162 and f02d874.

📒 Files selected for processing (1)
  • Dockerfile (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: unit-tests
  • GitHub Check: unit-tests
🔇 Additional comments (5)
Dockerfile (5)

23-38: Streamlined Dependency Installation
The consolidated apt-get command updates and installs all necessary dependencies in one go, and the inclusion of cleanup commands (apt-get autoremove -y and removal of /var/lib/apt/lists/*) is an excellent measure for reducing the final image size. Please verify that these dependencies fully support the updated logging features (e.g., Lua testing) introduced in the related log-handling changes.


40-41: Working Directory Setup
The WORKDIR /app directive is appropriately placed after the dependency installation stage. It clearly defines the context for subsequent operations.


42-44: Devcontainers CLI Installation
The command to install the devcontainers CLI (RUN npm install -g @devcontainers/[email protected]) is clear and reproducible by pinning the CLI version. Ensure that version 0.49.0 aligns with the overall project requirements and logging improvements.


45-47: Lua Dependencies for Testing
Installing testing dependencies via luarocks install busted is a straightforward and effective change that supports Lua project testing. Should more Lua packages become necessary with further log system enhancements, consider grouping related Lua dependencies for easier maintenance.


59-59: Secure Sudoers File Permission Setting
The modification on line 59 ensures that the sudoers file for the user has the correct permissions (0440), which is crucial for maintaining system security. This is a best practice, given the file’s sensitivity.

Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
@erichlf erichlf force-pushed the logger_fixes branch 2 times, most recently from ff9c53c to 0686bf9 Compare March 5, 2025 12:44
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: 0

🧹 Nitpick comments (3)
tests/minimal_init.lua (3)

21-27: Add a docstring or comment clarifying the purpose of ensure_dir().
Currently, this function is self-explanatory but adding a short docstring would help future maintainers.

+--- Creates the directory at the specified path if it does not already exist.
 local function ensure_dir(path)
   local stat = vim.loop.fs_stat(path)
   if not stat then
     vim.fn.mkdir(path, "p")
   end
 end

33-42: Consider consolidating the log and state fallback logic.
The approach for log_path can be reused for state_path, or both can be handled in a single helper function to reduce duplication. This is optional but can simplify maintenance.


44-51: Same fallback strategy as above.
You might unify the logic for log and state by creating a small wrapper function that calls vim.fn.stdpath("...") and falls back to "data/..." if unsupported.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ff9c53c and 0686bf9.

📒 Files selected for processing (1)
  • tests/minimal_init.lua (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: unit-tests
🔇 Additional comments (2)
tests/minimal_init.lua (2)

2-19: License text formatting update.
No functional changes identified.


29-32: Verify that directories are created correctly.
It may be helpful to confirm these directories are successfully created during test setup, for example, by asserting filesystem existence.

Would you like me to provide a script or sample test code snippet to verify directory creation for these standard paths?

Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
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: 1

🧹 Nitpick comments (1)
.github/workflows/default.yml (1)

14-15: Update Checkout Action Version
Static analysis tools flagged that the runner for actions/checkout@v3 might be outdated. Although v3 is widely used, consider updating to a more recent minor version (if available) to benefit from the latest fixes and improvements.

🧰 Tools
🪛 actionlint (1.7.4)

15-15: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0686bf9 and db541b2.

📒 Files selected for processing (2)
  • .github/workflows/default.yml (1 hunks)
  • Dockerfile (3 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/default.yml

15-15: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 GitHub Actions: default
Dockerfile

[error] 28-28: gzip: stdin: not in gzip format. tar: Child returned status 1. tar: Error is not recoverable: exiting now.


[error] 28-28: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-runner/container-features/0.74.0-1741179673396/Dockerfile-with-features -t nvim-devcontainer-cli-0.10.0:latest --target dev_containers_target_stage --cache-from nvim-devcontainer-cli-0.10.0:latest --cache-from nvim-devcontainer-cli-0.10.0 --build-arg USER_ID=1000 --build-arg GROUP_ID=1000 --build-context dev_containers_feature_content_source=/tmp/devcontainercli-runner/container-features/0.74.0-1741179673396 --build-arg _DEV_CONTAINERS_BASE_IMAGE=builder --build-arg _DEV_CONTAINERS_IMAGE_USER=my-app --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp.

🔇 Additional comments (5)
Dockerfile (1)

21-21: New Build Argument Added
The new build argument NEOVIM_VERSION=0.10.0 is properly defined to allow dynamic version selection for Neovim. Make sure downstream commands and documentation are updated accordingly.

.github/workflows/default.yml (4)

1-1: Simplified Workflow Trigger
The trigger has been updated to on: [pull_request], which aligns with the revised CI/CD strategy for this PR.


8-13: Matrix Strategy for Multiple Neovim Versions
The introduction of a matrix strategy with neovim-version: ["0.9.5", "0.10.0"] and fail-fast: false ensures that tests run across multiple Neovim versions, thereby increasing the robustness of the CI process.


16-23: Consistent Pre-build Image Configuration
The “Pre-build devcontainer image” step correctly applies the NEOVIM_VERSION via build arguments and properly adjusts the imageName and cacheFrom fields. This change aligns well with the Dockerfile modifications.


24-29: Test Execution Step Verification
The final step runs tests inside the Docker image, and the cache is appropriately scoped to the Neovim version. This ensures that the tests accurately reflect the runtime environment.

@erichlf erichlf force-pushed the logger_fixes branch 2 times, most recently from fbeffb7 to b7d8851 Compare March 5, 2025 13:16
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
@erichlf erichlf force-pushed the logger_fixes branch 4 times, most recently from 5f0d66b to ab29342 Compare March 5, 2025 13:53
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: 0

🧹 Nitpick comments (1)
.github/workflows/default.yml (1)

15-15: Update checkout action to a newer version.

The current checkout action version (v3) is flagged as outdated by static analysis. GitHub regularly updates actions with security improvements and bug fixes.

- uses: actions/checkout@v3
+ uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.4)

15-15: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b7d8851 and ab29342.

📒 Files selected for processing (4)
  • .github/workflows/default.yml (1 hunks)
  • Dockerfile (3 hunks)
  • README.md (2 hunks)
  • tests/minimal_init.lua (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dockerfile
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/default.yml

15-15: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (6)
tests/minimal_init.lua (2)

20-21: Proper runtime setup improves plugin test environment.

Adding these lines properly configures the Neovim runtime environment by ensuring the standard data path is included in the runtime path and setting the packpath to match. This is a best practice that helps ensure plugins are correctly loaded during testing.


25-26: Improved git clone efficiency with depth parameter.

Using --depth=1 when cloning Plenary is a good optimization as it only fetches the latest snapshot instead of the entire repository history, making the test setup faster and more efficient.

.github/workflows/default.yml (4)

1-1: Verify the impact of removing the push trigger.

Limiting workflow execution to only pull requests and removing the push trigger means the tests won't run when changes are pushed directly to important branches (like main/master). Consider whether this is the intended behavior for this repository's workflow.


8-11: Great addition of Neovim version matrix.

Testing against multiple Neovim versions (0.9.5 and 0.10.0) with the matrix strategy ensures broader compatibility. Setting fail-fast: false is also good practice as it allows all version tests to complete even if one fails.


19-23: Well-structured Docker image configuration with version parameterization.

Using the matrix Neovim version to create distinct Docker images with appropriate caching and build arguments is a good approach. This ensures each test environment precisely matches its target Neovim version.


27-27: Consistent cache usage across workflow steps.

Using the versioned image name for caching ensures the right environment is used for tests, maintaining consistency with the pre-build step.

@erichlf erichlf force-pushed the logger_fixes branch 4 times, most recently from a225814 to a845007 Compare March 5, 2025 14:10
@erichlf erichlf force-pushed the logger_fixes branch 2 times, most recently from 4c11fbd to 18a5a34 Compare March 5, 2025 15:55
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
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: 0

♻️ Duplicate comments (1)
Dockerfile (1)

45-53: 🛠️ Refactor suggestion

⚠️ Potential issue

Shell Conditional and Extraction Logic Issues.
The RUN command block uses the bash-specific [[ ... ]] construct which may fail under /bin/sh (typically dash in Ubuntu). Please update it to a POSIX-compliant conditional, for example:

-  if [[ "$NEOVIM_VERSION" == "stable" ]]; then \
+  if [ "$NEOVIM_VERSION" = "stable" ]; then \

Additionally, the tar extraction and symlink creation steps assume that the extracted directory name will match the pattern used for the symlink. This could lead to a dangling symlink if the tarball’s internal directory name (e.g. nvim-linux-x86_64 or nvim-linux64) does not conform to the expected pattern.
Consider refactoring this segment to first extract the tarball without a target directory (or extract it in the current working directory), then rename/move the extracted folder to a fixed location (e.g. /opt/nvim) before creating the symlink. This approach was detailed in previous review comments and remains applicable.

🧰 Tools
🪛 GitHub Actions: default

[error] 46-46: /bin/sh: 1: [[: not found


[error] 46-46: curl: (22) The requested URL returned error: 404


[error] 46-46: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-runner/container-features/0.74.0-1741190163596/Dockerfile-with-features -t nvim-devcontainer-cli-v0.9.1:latest --target dev_containers_target_stage --cache-from nvim-devcontainer-cli-v0.9.1:latest --cache-from nvim-devcontainer-cli-v0.9.1 --build-arg USER_ID=1000 --build-arg GROUP_ID=1000 --build-context dev_containers_feature_content_source=/tmp/devcontainercli-runner/container-features/0.74.0-1741190163596 --build-arg _DEV_CONTAINERS_BASE_IMAGE=builder --build-arg _DEV_CONTAINERS_IMAGE_USER=my-app --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /home/runner/work/devcontainer-cli.nvim/devcontainer-cli.nvim (exit code: undefined)

🧹 Nitpick comments (1)
.github/workflows/default.yml (1)

43-43: Note on Log Level and Error Handling Changes.
The PR title indicates improvements to log level and error handling. However, none of the changes in this file address logging functionality. Please ensure that the intended changes in lua/devcontainer-cli/log.lua (or the relevant module) are included and reviewed separately.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7d76da8 and 18a5a34.

📒 Files selected for processing (4)
  • .github/workflows/default.yml (1 hunks)
  • Dockerfile (3 hunks)
  • README.md (2 hunks)
  • tests/minimal_init.lua (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • README.md
  • tests/minimal_init.lua
🧰 Additional context used
🪛 GitHub Actions: default
Dockerfile

[error] 46-46: /bin/sh: 1: [[: not found


[error] 46-46: curl: (22) The requested URL returned error: 404


[error] 46-46: Command failed: docker buildx build --load --build-arg BUILDKIT_INLINE_CACHE=1 -f /tmp/devcontainercli-runner/container-features/0.74.0-1741190163596/Dockerfile-with-features -t nvim-devcontainer-cli-v0.9.1:latest --target dev_containers_target_stage --cache-from nvim-devcontainer-cli-v0.9.1:latest --cache-from nvim-devcontainer-cli-v0.9.1 --build-arg USER_ID=1000 --build-arg GROUP_ID=1000 --build-context dev_containers_feature_content_source=/tmp/devcontainercli-runner/container-features/0.74.0-1741190163596 --build-arg _DEV_CONTAINERS_BASE_IMAGE=builder --build-arg _DEV_CONTAINERS_IMAGE_USER=my-app --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp /home/runner/work/devcontainer-cli.nvim/devcontainer-cli.nvim (exit code: undefined)

🔇 Additional comments (6)
Dockerfile (4)

22-23: NEOVIM_VERSION argument defined correctly.
The declaration of ARG NEOVIM_VERSION="stable" is clear and sets a default version for Neovim, enabling dynamic builds based on the version supplied.


25-40: Dependency Installation Steps.
The updated RUN command that installs dependencies without sudo and clears the apt cache is well-structured. This optimization reduces bloat in the final image.


55-61: Devcontainer CLI and Lua Dependency Installation.
The process for installing the devcontainers CLI and Lua dependencies (using npm and luarocks) is clear and consistent.


66-73: User and Sudoers Setup.
The user creation, group assignment, and sudoers configuration are correctly implemented. The explicit permission setup with chmod 0440 contributes to system security.

.github/workflows/default.yml (2)

1-24: Workflow Trigger and Matrix Strategy Update.
Switching the trigger to pull_request and introducing a matrix strategy for running tests with multiple Neovim versions enhances testing coverage and ensures compatibility with various versions. The YAML structure is clean and effective.


25-42: CI Steps and Pre-build Configuration.
The checkout step is updated to use actions/checkout@v4, and the pre-build step properly passes the Neovim version as a build argument. The use of environment variables to configure imageName and cacheFrom ensures consistency with the Dockerfile changes.

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: 0

🧹 Nitpick comments (3)
Dockerfile (3)

45-49: Conditional Download of Neovim Tarball
Using an if statement to download different tarballs based on the NEOVIM_VERSION is a practical solution. However, consider verifying that the filenames (nvim-linux-x86_64.tar.gz vs. nvim-linux64.tar.gz) exactly match the release asset names on GitHub. Additionally, it may be beneficial to add error checking (for example, ensuring the curl command succeeds) so that failures in downloading are caught early.


50-53: Tar Extraction and Post-Extraction Cleanup
The extraction command using the wildcard (nvim-*.tar.gz) and the subsequent creation of a symbolic link works fine. As an enhancement, consider cleaning up the downloaded tarball after extraction to reduce the image size and remove temporary files.


67-72: User Setup and Sudo Installation
The commands to add a group, add a user, install sudo, and set the sudoers permissions are standard. Given that one of the PR objectives was to remove unnecessary usage of sudo, please double-check whether installing sudo is still required. If your workflows run as root or if elevated privileges aren’t needed post-build, removing sudo may simplify your image and tighten security.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 18a5a34 and 2a23eb1.

📒 Files selected for processing (4)
  • .github/workflows/default.yml (1 hunks)
  • Dockerfile (3 hunks)
  • README.md (2 hunks)
  • tests/minimal_init.lua (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • README.md
  • tests/minimal_init.lua
🔇 Additional comments (6)
Dockerfile (1)

22-23: Add NEOVIM_VERSION Build Argument
Adding the build argument with a default value of "stable" is a clear and useful addition. This lets you control the Neovim version at build time. Please ensure that all references to this argument in subsequent commands remain consistent.

.github/workflows/default.yml (5)

1-1: Pull Request Trigger Configuration
Switching the event trigger to pull_request aligns well with the current CI strategy. This ensures that the tests run only when necessary.


8-24: Matrix Strategy for Neovim Versions
The matrix strategy is well defined. Testing across multiple Neovim versions—including explicit versions and "stable"—ensures broad compatibility. This setup helps catch issues across different environments.


28-29: Update Checkout Action Version
Using actions/checkout@v4 is a positive update. It keeps your workflow up to date with the latest improvements and fixes from the checkout action.


32-35: Pre-build Step and Build Arguments
The pre-build step correctly leverages the devcontainers/[email protected] action. The image naming and caching strategy are clear, and the build argument is formatted as a space-separated key-value pair, which resolves previous formatting issues.


37-41: Running Tests in the Docker Image
Running make test inside the built image is straightforward. Just verify that all needed test dependencies are present in the image so that tests run reliably across the different Neovim versions.

@erichlf erichlf force-pushed the logger_fixes branch 4 times, most recently from 439f322 to 23bd427 Compare March 5, 2025 17:07
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
Repository owner deleted a comment from coderabbitai bot Mar 5, 2025
@erichlf erichlf force-pushed the logger_fixes branch 8 times, most recently from 5bbe79f to fdd4030 Compare March 5, 2025 17:53
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: 0

🧹 Nitpick comments (2)
Dockerfile (2)

27-41: Dependency Installation and Cleanup
The updated installation block (lines 27–41) effectively installs the required packages without unnecessary privileges. The use of DEBIAN_FRONTEND=noninteractive and cleanup commands improves reliability and reduces image bloat.

Optional: Consider verifying if every listed package is needed to keep the image as lean as possible.


47-55: Conditional NEOVIM Installation
The conditional block (lines 47–55) correctly selects the appropriate Neovim tarball based on whether NEOVIM_VERSION equals "stable". Using curl -fLO ensures that failures stop the build.

Optional: You might consider adding comments or additional error handling (if deemed necessary) to document the rationale behind the different tarball names.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c4cef45 and c7fe5fe.

📒 Files selected for processing (4)
  • .github/workflows/default.yml (1 hunks)
  • Dockerfile (3 hunks)
  • README.md (2 hunks)
  • tests/minimal_init.lua (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • README.md
  • tests/minimal_init.lua
🔇 Additional comments (8)
Dockerfile (3)

21-21: Default NEOVIM_VERSION Argument Initialization
The addition of ARG NEOVIM_VERSION="stable" at line 21 correctly provides a default value and makes the build more predictable.


24-24: Redeclaring NEOVIM_VERSION in the Builder Stage
Re-declaring the ARG NEOVIM_VERSION here is necessary for multi-stage builds so that the variable is available in the builder stage. This is a proper use of Dockerfile scoping.


73-74: Securing the Sudoers File
The command at line 74 that sets permissions on the sudoers file (chmod 0440 /etc/sudoers.d/$USER_NAME) is a good security measure, ensuring that the file is not writable by unauthorized users.

.github/workflows/default.yml (5)

1-1: Workflow Trigger Update
Changing the event trigger to on: [pull_request] ensures that this workflow runs only when pull requests are created or updated. This reduces unnecessary builds and aligns with the PR’s focus on improving runtimes.


8-24: Enhanced Testing Matrix with Multiple Neovim Versions
The newly defined strategy matrix (lines 8–24) now includes a robust list of Neovim versions—including "stable"—to test the devcontainer across a variety of environments. This will improve compatibility verification.


28-28: Checkout Action Upgrade
The upgrade of the checkout step to actions/checkout@v4 is current and helps ensure better performance and security.


32-35: Dynamic Devcontainer Image Pre-Build
By constructing the image name and cache key with ${{ env.IMAGE_NAME }}-${{ matrix.neovim-version }} and passing NEOVIM_VERSION=${{ matrix.neovim-version }} to the build step, the workflow cleanly ties the Dockerfile parameter to the testing matrix. This ensures that the correct Neovim version is installed.


39-39: Consistency in Test Step Cache Usage
The test step also uses the updated cache key format (line 39), which ensures consistency between the build and test phases.

@erichlf erichlf merged commit 50a1c6f into main Mar 5, 2025
2 checks passed
@erichlf erichlf deleted the logger_fixes branch March 5, 2025 18:28
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.

1 participant