Skip to content
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

Upgrade Rust to 1.85 #289

Merged
merged 2 commits into from
Feb 25, 2025
Merged

Upgrade Rust to 1.85 #289

merged 2 commits into from
Feb 25, 2025

Conversation

andy1li
Copy link
Member

@andy1li andy1li commented Feb 25, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a new Docker container image that supports Rust 1.85.
  • Chores

    • Standardized build and execution paths for improved consistency.
    • Updated package identifiers to align with current project branding.
    • Upgraded the Rust language pack from version 1.82 to 1.85.

@andy1li andy1li self-assigned this Feb 25, 2025
Copy link

coderabbitai bot commented Feb 25, 2025

Walkthrough

This pull request updates various Rust project files by changing the build target directory from /tmp/codecrafters-redis-target to /tmp/codecrafters-build-redis-rust and updating the executable name from redis-starter-rust to codecrafters-redis. The package identifier in Cargo.toml files has been modified accordingly, and the language pack version in configuration files is upgraded from rust-1.82 to rust-1.85. Additionally, a new Dockerfile for Rust 1.85 has been introduced.

Changes

File Group Change Summary
compile.sh Files
compiled_starters/rust/.codecrafters/compile.sh
solutions/rust/01-jm1/code/.codecrafters/compile.sh
solutions/rust/02-rg2/code/.codecrafters/compile.sh
starter_templates/rust/code/.codecrafters/compile.sh
Updated build target directory from /tmp/codecrafters-redis-target to /tmp/codecrafters-build-redis-rust.
run.sh Files
compiled_starters/rust/.codecrafters/run.sh
solutions/rust/01-jm1/code/.codecrafters/run.sh
solutions/rust/02-rg2/code/.codecrafters/run.sh
starter_templates/rust/code/.codecrafters/run.sh
Updated command to execute /tmp/codecrafters-build-redis-rust/release/codecrafters-redis instead of the old executable.
Cargo.toml Files
compiled_starters/rust/Cargo.toml
solutions/rust/01-jm1/code/Cargo.toml
solutions/rust/02-rg2/code/Cargo.toml
starter_templates/rust/code/Cargo.toml
Package name changed from "redis-starter-rust" to "codecrafters-redis".
codecrafters.yml Files
compiled_starters/rust/codecrafters.yml
solutions/rust/01-jm1/code/codecrafters.yml
solutions/rust/02-rg2/code/codecrafters.yml
Updated language pack version from rust-1.82 to rust-1.85.
your_program.sh Files
compiled_starters/rust/your_program.sh
solutions/rust/01-jm1/code/your_program.sh
solutions/rust/02-rg2/code/your_program.sh
Modified build and execution paths to reflect the new target directory and executable name.
Dockerfile
dockerfiles/rust-1.85.Dockerfile
New Dockerfile added for Rust 1.85 based on rust:1.85-bookworm, with dependency file paths and build commands updated.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RunScript
    participant Binary
    User->>RunScript: Execute run.sh with arguments
    RunScript->>Binary: Call /tmp/codecrafters-build-redis-rust/release/codecrafters-redis
    Binary-->>RunScript: Return result/status
    RunScript-->>User: Output result
Loading
sequenceDiagram
    participant CompileScript
    participant CargoBuild
    CompileScript->>CargoBuild: Execute cargo build with updated target
    CargoBuild-->>CompileScript: Store build artifacts in /tmp/codecrafters-build-redis-rust
Loading

Possibly Related PRs

Poem

In the code burrow where logic runs deep,
I hop through the scripts with a leap.
New paths emerge on the build and run,
From redis to codecrafters – oh what fun!
Hopping ahead, my whiskers sing with glee! 🐰✨


📜 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 16223e9 and c794c1e.

⛔ Files ignored due to path filters (4)
  • compiled_starters/rust/Cargo.lock is excluded by !**/*.lock
  • solutions/rust/01-jm1/code/Cargo.lock is excluded by !**/*.lock
  • solutions/rust/02-rg2/code/Cargo.lock is excluded by !**/*.lock
  • starter_templates/rust/code/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • compiled_starters/rust/.codecrafters/compile.sh (1 hunks)
  • compiled_starters/rust/.codecrafters/run.sh (1 hunks)
  • compiled_starters/rust/Cargo.toml (1 hunks)
  • compiled_starters/rust/codecrafters.yml (1 hunks)
  • compiled_starters/rust/your_program.sh (1 hunks)
  • dockerfiles/rust-1.85.Dockerfile (1 hunks)
  • solutions/rust/01-jm1/code/.codecrafters/compile.sh (1 hunks)
  • solutions/rust/01-jm1/code/.codecrafters/run.sh (1 hunks)
  • solutions/rust/01-jm1/code/Cargo.toml (1 hunks)
  • solutions/rust/01-jm1/code/codecrafters.yml (1 hunks)
  • solutions/rust/01-jm1/code/your_program.sh (1 hunks)
  • solutions/rust/02-rg2/code/.codecrafters/compile.sh (1 hunks)
  • solutions/rust/02-rg2/code/.codecrafters/run.sh (1 hunks)
  • solutions/rust/02-rg2/code/Cargo.toml (1 hunks)
  • solutions/rust/02-rg2/code/codecrafters.yml (1 hunks)
  • solutions/rust/02-rg2/code/your_program.sh (1 hunks)
  • starter_templates/rust/code/.codecrafters/compile.sh (1 hunks)
  • starter_templates/rust/code/.codecrafters/run.sh (1 hunks)
  • starter_templates/rust/code/Cargo.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (18)
  • starter_templates/rust/code/.codecrafters/compile.sh
  • compiled_starters/rust/.codecrafters/compile.sh
  • solutions/rust/01-jm1/code/codecrafters.yml
  • compiled_starters/rust/Cargo.toml
  • solutions/rust/01-jm1/code/Cargo.toml
  • solutions/rust/02-rg2/code/codecrafters.yml
  • compiled_starters/rust/codecrafters.yml
  • solutions/rust/02-rg2/code/Cargo.toml
  • solutions/rust/02-rg2/code/.codecrafters/compile.sh
  • solutions/rust/01-jm1/code/.codecrafters/compile.sh
  • solutions/rust/02-rg2/code/your_program.sh
  • compiled_starters/rust/your_program.sh
  • solutions/rust/01-jm1/code/.codecrafters/run.sh
  • solutions/rust/01-jm1/code/your_program.sh
  • starter_templates/rust/code/.codecrafters/run.sh
  • starter_templates/rust/code/Cargo.toml
  • solutions/rust/02-rg2/code/.codecrafters/run.sh
  • compiled_starters/rust/.codecrafters/run.sh
🧰 Additional context used
🪛 Hadolint (2.12.0)
dockerfiles/rust-1.85.Dockerfile

[error] 10-10: invalid flag: --exclude

(DL1000)


🪧 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. (Beta)
  • @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 e9f515e and 16223e9.

⛔ Files ignored due to path filters (4)
  • compiled_starters/rust/Cargo.lock is excluded by !**/*.lock
  • solutions/rust/01-jm1/code/Cargo.lock is excluded by !**/*.lock
  • solutions/rust/02-rg2/code/Cargo.lock is excluded by !**/*.lock
  • starter_templates/rust/code/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (19)
  • compiled_starters/rust/.codecrafters/compile.sh (1 hunks)
  • compiled_starters/rust/.codecrafters/run.sh (1 hunks)
  • compiled_starters/rust/Cargo.toml (1 hunks)
  • compiled_starters/rust/codecrafters.yml (1 hunks)
  • compiled_starters/rust/your_program.sh (1 hunks)
  • dockerfiles/rust-1.85.Dockerfile (1 hunks)
  • solutions/rust/01-jm1/code/.codecrafters/compile.sh (1 hunks)
  • solutions/rust/01-jm1/code/.codecrafters/run.sh (1 hunks)
  • solutions/rust/01-jm1/code/Cargo.toml (1 hunks)
  • solutions/rust/01-jm1/code/codecrafters.yml (1 hunks)
  • solutions/rust/01-jm1/code/your_program.sh (1 hunks)
  • solutions/rust/02-rg2/code/.codecrafters/compile.sh (1 hunks)
  • solutions/rust/02-rg2/code/.codecrafters/run.sh (1 hunks)
  • solutions/rust/02-rg2/code/Cargo.toml (1 hunks)
  • solutions/rust/02-rg2/code/codecrafters.yml (1 hunks)
  • solutions/rust/02-rg2/code/your_program.sh (1 hunks)
  • starter_templates/rust/code/.codecrafters/compile.sh (1 hunks)
  • starter_templates/rust/code/.codecrafters/run.sh (1 hunks)
  • starter_templates/rust/code/Cargo.toml (1 hunks)
✅ Files skipped from review due to trivial changes (13)
  • solutions/rust/02-rg2/code/.codecrafters/compile.sh
  • starter_templates/rust/code/.codecrafters/compile.sh
  • compiled_starters/rust/.codecrafters/compile.sh
  • solutions/rust/01-jm1/code/.codecrafters/compile.sh
  • starter_templates/rust/code/Cargo.toml
  • solutions/rust/02-rg2/code/Cargo.toml
  • solutions/rust/02-rg2/code/codecrafters.yml
  • solutions/rust/01-jm1/code/codecrafters.yml
  • compiled_starters/rust/codecrafters.yml
  • solutions/rust/01-jm1/code/.codecrafters/run.sh
  • compiled_starters/rust/.codecrafters/run.sh
  • solutions/rust/01-jm1/code/Cargo.toml
  • compiled_starters/rust/Cargo.toml
🧰 Additional context used
🪛 Hadolint (2.12.0)
dockerfiles/rust-1.85.Dockerfile

[error] 10-10: invalid flag: --exclude

(DL1000)

🔇 Additional comments (10)
starter_templates/rust/code/.codecrafters/run.sh (1)

11-11: Executable Path Update Confirmed.

The exec command now correctly points to the new path (/tmp/codecrafters-build-redis-rust/release/codecrafters-redis), which is consistent with the updated build structure as per the PR objectives.

solutions/rust/01-jm1/code/your_program.sh (2)

17-17: Updated Cargo Build Command.

The cargo build invocation now uses the new target directory (/tmp/codecrafters-build-redis-rust) and remains correctly configured via the --manifest-path option.


24-24: Runtime Execution Command Update.

The exec command has been updated to use the new executable path (/tmp/codecrafters-build-redis-rust/release/codecrafters-redis), aligning with the revised naming and directory structure.

dockerfiles/rust-1.85.Dockerfile (2)

1-9: Dockerfile Base and Environment Setup.

The Dockerfile now uses the Rust 1.85 image and appropriately sets the environment variable for dependency file paths. This configuration helps ensure that rebuilds are triggered when critical files change.


12-13: Build Script Invocation.

The RUN command correctly calls the compile script (.codecrafters/compile.sh). Ensure that the compile script is updated in tandem with the new build target and executable naming changes.

solutions/rust/02-rg2/code/your_program.sh (2)

17-17: Updated Cargo Build Command.

The updated cargo build command now specifies the new target directory (/tmp/codecrafters-build-redis-rust), ensuring consistency with the new build structure.


24-24: Updated Runtime Executable Path.

The exec command properly references the updated executable (/tmp/codecrafters-build-redis-rust/release/codecrafters-redis), confirming alignment with the new naming changes.

compiled_starters/rust/your_program.sh (2)

17-17: Updated Cargo Build Invocation.

The cargo build command now targets /tmp/codecrafters-build-redis-rust, which is consistent with the adjustments made across the repository.


24-24: Executable Path Consistency.

The exec step is updated to match the new executable location (/tmp/codecrafters-build-redis-rust/release/codecrafters-redis), ensuring uniformity across different scripts.

solutions/rust/02-rg2/code/.codecrafters/run.sh (1)

11-11: Updated executable command correctly reflects the Rust 1.85 upgrade.

The new command uses /tmp/codecrafters-build-redis-rust/release/codecrafters-redis instead of the old executable path. This aligns with the changes in build target directory and package identifier as described in the PR objectives. Ensure that all related files (e.g., compile.sh, Cargo.toml, and configuration files) consistently use this new path and binary name.

WORKDIR /app

# .git & README.md are unique per-repository. We ignore them on first copy to prevent cache misses
COPY --exclude=.git --exclude=README.md . /app
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

⚠️ Potential issue

Fix COPY Command Exclusion Flags.

Hadolint flagged the use of --exclude on COPY as invalid. Docker’s COPY command does not support exclusion flags; instead, you should list .git and README.md in a .dockerignore file. Consider updating the command as follows:

-COPY --exclude=.git --exclude=README.md . /app
+COPY . /app

And ensure your .dockerignore contains:

.git
README.md
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
COPY --exclude=.git --exclude=README.md . /app
COPY . /app
🧰 Tools
🪛 Hadolint (2.12.0)

[error] 10-10: invalid flag: --exclude

(DL1000)

@andy1li andy1li merged commit 2d674b5 into main Feb 25, 2025
32 checks passed
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