-
Notifications
You must be signed in to change notification settings - Fork 0
Containerized compilation #81
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
Conversation
…ed resource management
…ced process management; update max path depth in validation from 1 to 2
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Pull request overview
This PR refactors the architecture to move compilation into the containerized executor stage, eliminating the dedicated compiler interface and host-based compilation. Compilation now occurs inside Docker containers, with errors detected by checking a compilation error file after execution completes. This change simplifies the pipeline and removes the dependency on g++ in the host environment.
Key Changes
- Removed the compiler stage, interface, and all related code, consolidating compilation into the executor stage where it runs inside containers
- Modified the pipeline to detect compilation errors by checking file size after execution instead of catching exceptions from a compiler interface
- Enhanced the Docker client and tar extraction utilities to support an
alwaysCopyFilesparameter, ensuring compilation error files are always extracted from containers
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
cmd/main.go |
Removed compiler initialization and dependency injection |
Dockerfile |
Removed g++ from builder and runtime images as compilation now happens in containers |
generate_mocks.sh |
Removed compiler mock generation |
internal/docker/docker_client.go |
Added alwaysCopyFiles parameter to enable extracting compilation error files regardless of directory restrictions |
internal/pipeline/pipeline.go |
Removed compiler dependency, added compilation error detection via file size check after execution |
internal/scheduler/scheduler.go |
Removed compiler from scheduler constructor and worker initialization |
internal/scheduler/scheduler_test.go |
Updated tests to remove compiler mock usage |
internal/stages/compiler/compiler.go |
Deleted entire compiler interface and implementation |
internal/stages/compiler/compiler_test.go |
Deleted compiler tests |
internal/stages/compiler/cpp_compiler.go |
Deleted C++ compiler implementation |
internal/stages/compiler/cpp_compiler_test.go |
Deleted C++ compiler tests |
internal/stages/executor/cpp/Dockerfile |
Added g++ to container runtime to support in-container compilation |
internal/stages/executor/executor.go |
Added buildCompileCommand function and compilation-related fields to CommandConfig, updated environment variables to pass compilation commands to container |
internal/stages/executor/executor_test.go |
Updated mock expectations to account for new alwaysCopyFiles parameter |
internal/stages/executor/run_tests.sh |
Added compilation logic to handle in-container compilation before test execution |
internal/pipeline/pipeline_test.go |
Refactored all tests to remove compiler mocks and simulate compilation errors via file writes |
tests/mocks/mocks_generated.go |
Removed compiler mock, updated Docker client mock signature |
utils/utils.go |
Refactored ExtractTarArchiveFiltered to support alwaysCopyFiles parameter, added helper functions and context struct for cleaner code organization |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request removes the dedicated compiler stage from the codebase, shifting compilation responsibility into the executor stage. The pipeline now detects compilation errors by checking for output in the compilation error file after execution, rather than relying on a separate compiler interface. The changes also update related tests and dependency injection throughout the codebase to reflect this architectural change.
Pipeline and Architecture Refactor:
Removed the
compilerstage and interface from the worker pipeline, dependency injection, and related code, consolidating compilation into the executor stage (cmd/main.go,internal/pipeline/pipeline.go,generate_mocks.sh) [1] [2] [3] [4] [5] [6] [7] [8].Updated the task processing logic to check for compilation errors by inspecting the compilation error file after execution, instead of invoking a compiler interface. This includes handling for both success and error flows (
internal/pipeline/pipeline.go) [1] [2] [3] [4].Testing Updates:
internal/pipeline/pipeline_test.go) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12].Docker and Build Environment:
g++from both the builder and runtime images in theDockerfile, reflecting the removal of the dedicated compiler stage (Dockerfile) [1] [2].Executor and Docker Client Enhancements:
alwaysCopyFilesparameter for more flexible file extraction from containers (internal/docker/docker_client.go) [1] [2] [3].