-
Notifications
You must be signed in to change notification settings - Fork 296
Upgrade Language Versions and Add New Language Support via Alpine Base Docker Image #175
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
base: main
Are you sure you want to change the base?
Upgrade Language Versions and Add New Language Support via Alpine Base Docker Image #175
Conversation
…ory configurations
…atting and additional scenarios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @Abhinav-Prajapati, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request represents a significant enhancement to our code execution environment. My primary goal was to broaden the spectrum of supported programming languages and ensure that our existing language runtimes are current. This was achieved by migrating the language setup to a new Alpine-based Docker image, which offers substantial benefits in terms of build efficiency and package management. Additionally, I've integrated comprehensive memory usage tracking and validation into the execution and testing pipeline, providing better insights into resource consumption.
Highlights
- New Language Support: I've added support for several new programming languages: Go, PHP, TypeScript (TSC), C# (via Mono), and Kotlin. This significantly expands the range of executable code types the system can handle.
- Language Version Upgrades: Core language versions for Node.js, Python, Java, Ruby, and GCC have been upgraded to their latest stable releases, ensuring the environment is up-to-date.
- Alpine-based Docker Environment: A new
Dockerfile.alpinehas been introduced to build a lightweight, Alpine Linux-based Docker image. This approach simplifies dependency management usingapk, speeds up build times, and keeps the main Dockerfile clean. - Memory Usage Monitoring & Testing: The execution service now includes robust memory usage monitoring for all languages, capturing and reporting the actual memory consumed by executed code. Corresponding test cases have been updated to validate memory limits with a defined tolerance.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request significantly expands language support and updates existing versions by introducing a new Alpine-based Docker image. The changes are generally well-structured, and the addition of memory usage reporting and testing is a valuable improvement.
Key areas for attention within Dockerfile.alplne include a syntax error in a RUN command that will break the build, the unconventional use of /usr/bin/ for application code and node_modules, and a leftover PATH entry for Swift (which is noted as unsupported). Addressing these will improve the Docker image's correctness, maintainability, and adherence to best practices.
Additionally, enhancing the new language test cases in tests/data/testJson.js to include approxMemoryUses would provide more robust validation for these additions.
| adduser -S -D -u 2000 -s /sbin/nologin -h /tmp -G runner runner | ||
|
|
||
| # Set up environment variables for all languages | ||
| ENV PATH="/opt/node/bin:/opt/swift/usr/bin:$PATH" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ENV PATH includes /opt/swift/usr/bin. However, the PR description explicitly states that Swift is not supported due to Alpine's incompatibility with glibc. This path entry appears to be a leftover or mistake and should be removed to avoid confusion and keep the environment clean.
ENV PATH="/opt/node/bin:$PATH"
| name: "Go: Basic Hello World", | ||
| reqObject: { | ||
| language: "go", | ||
| script: ` | ||
| package main | ||
| import "fmt" | ||
| func main() { | ||
| fmt.Println("Language: Go") | ||
| }` | ||
| }, | ||
| expectedResponse: { | ||
| val: "Language: Go\n", | ||
| status: 200, | ||
| error: 0 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new test case for Go does not include the approxMemoryUses field in expectedResponse. While basic execution is tested, adding expected memory usage would make these tests consistent with the memory validation strategy applied to other languages and provide more comprehensive testing for the new additions.
| name: "PHP: Basic Hello World", | ||
| reqObject: { | ||
| language: "php", | ||
| script: ` | ||
| <?php echo "Language: PHP";?>` | ||
| }, | ||
| expectedResponse: { | ||
| val: "\nLanguage: PHP", | ||
| status: 200, | ||
| error: 0 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name: "TypeScript: Basic Hello World", | ||
| reqObject: { | ||
| language: "typescript", | ||
| script: ` | ||
| function main(): void { | ||
| console.log("Language: TypeScript"); | ||
| } | ||
| main();` | ||
| }, | ||
| expectedResponse: { | ||
| val: "Language: TypeScript\n", | ||
| status: 200, | ||
| error: 0 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name: "C#: Basic Hello World", | ||
| reqObject: { | ||
| language: "csharp", | ||
| script: ` | ||
| using System; | ||
| class Solution { | ||
| static void Main(string[] args) { | ||
| Console.WriteLine("Language: C#"); | ||
| } | ||
| }` | ||
| }, | ||
| expectedResponse: { | ||
| val: "Language: C#\n", | ||
| status: 200, | ||
| error: 0 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| name: "Kotlin: Basic Hello World", | ||
| reqObject: { | ||
| language: "kotlin", | ||
| script: ` | ||
| fun main() { | ||
| println("Language: Kotlin") | ||
| }` | ||
| }, | ||
| expectedResponse: { | ||
| val: "Language: Kotlin\n", | ||
| status: 200, | ||
| error: 0 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
You are above your monthly Qodo Merge usage quota. For more information, please visit here. |
2 similar comments
|
You are above your monthly Qodo Merge usage quota. For more information, please visit here. |
|
You are above your monthly Qodo Merge usage quota. For more information, please visit here. |
Summary
Upgraded core language versions (Node.js, Python, Java, Ruby, GCC) to newer stable releases.
Added support for additional languages: Go, PHP, TypeScript (TSC), C# (Mono), Kotlin.
Note: Swift is not supported due to Alpine’s incompatibility with
glibc.Key Changes
Introduced a new
Dockerfile.alpineinstead of modifying the mainDockerfileto:Simplify dependency management via Alpine’s
apk.Avoid cluttering the main Dockerfile due to major changes in language setup logic.
Ensure quicker builds using precompiled packages.
Why This Change?
Testing
Updated tests to validate new languages: Go, PHP, TypeScript, C#, Kotlin.