Automated PR Evaluation and Multi-Architecture Docker Image Builder
This project provides a comprehensive automation system for:
- Building universal Docker images supporting linux/amd64 and linux/arm64 architectures
- Automated PR (Pull Request) evaluation with test execution and validation
- Docker-based test harness for reproducible testing environments
- Features
- Documentation
- Quick Start
- Installation
- Project Structure
- Usage
- Prerequisites
- Troubleshooting
- Build universal Docker images that work on both Intel/AMD and ARM architectures
- Single OCI-compliant tarball containing both architecture variants
- Automatic architecture selection when loading images
- Automated PR cloning and evaluation
- Language and test framework detection
- Docker-based isolated test execution
- Comprehensive test result categorization and metadata generation
- Support for Python, JavaScript, TypeScript, Go, Rust, Java, C#, and Ruby
- Self-healing Docker builds
- Configurable test execution with retries
- Detailed logging and error reporting
- Workspace management and cleanup
This project is organized into distinct modules, each with its own detailed documentation:
| Module | README | Description |
|---|---|---|
| PR Evaluation System | automation_script/README.md | Full guide to the two-phase PR evaluation pipeline: Docker image building, test execution, patch evaluation, metadata generation, and VeloraHarness integration |
| Multi-Arch Build Utilities | automation_script_build_multi/README.md | Utility functions for multi-architecture Docker image builds, including command execution helpers |
| Installation Guide | INSTALL.txt | Step-by-step manual installation instructions for all supported platforms |
For a quick overview, continue reading this README. For in-depth usage of the PR evaluation system (command options, output format, supported languages, test identifier formats, VeloraHarness integration), see automation_script/README.md.
# Clone the repository
git clone <repository-url>
cd Automation_jager
# Run the installation script
chmod +x install.sh
./install.shThe installation script will automatically:
- Detect your operating system
- Install Python 3.8+, Docker, Docker Buildx, and GitHub CLI
- Configure Docker permissions
- Install Python dependencies
See INSTALL.txt for detailed manual installation instructions.
This project provides multiple ways to install dependencies:
./install.shInteractive script that installs all required dependencies automatically.
Follow the comprehensive guide in INSTALL.txt for platform-specific manual installation steps.
python3 -m pip install -r requirements.txtNote: This project uses Python standard library modules, so no external packages are required.
- Python 3.8 or higher
- Docker 20.10 or higher
- Docker Buildx plugin
- GitHub CLI (optional but recommended for PR operations)
- 4GB RAM (8GB recommended)
- 10GB free disk space
- macOS 10.15 or higher
- Ubuntu 20.04 or higher
- Debian 10 or higher
- Fedora 35 or higher
- RHEL/CentOS 8 or higher
# Check Python
python3 --version # Should be 3.8+
# Check Docker
docker --version
docker info
# Check Buildx
docker buildx version
# Check GitHub CLI (optional)
gh --versionAutomation_jager/
├── build_universal_image.py # Multi-arch Docker image builder
├── install.sh # Automated installation script
├── requirements.txt # Python dependencies
├── INSTALL.txt # Detailed installation guide
├── README.md # This file (start here)
│
├── automation_script/ # Main automation package
│ ├── README.md # Detailed module documentation (see Documentation section)
│ ├── __init__.py
│ ├── main_orchestrator.py # Main entry point for PR evaluation
│ ├── part1_build_and_base.py # Docker build and base testing
│ ├── part2_patch_and_evaluate.py # Patch application and evaluation
│ │
│ ├── config.py # Configuration and constants
│ ├── docker_builder_new.py # Docker image generation
│ ├── docker_runner.py # Container test execution
│ ├── docker_healing.py # Self-healing Docker builds
│ ├── container_runner.py # Advanced container operations
│ │
│ ├── git_operations.py # Git utilities
│ ├── git_wrappers.py # High-level Git operations
│ ├── github_api.py # GitHub API interactions
│ │
│ ├── language_detection.py # Language/framework detection
│ ├── environment.py # Environment detection and setup
│ ├── test_results.py # Test result processing
│ ├── test_targeting.py # Test identification
│ │
│ ├── metadata.py # Metadata structure definitions
│ ├── metadata_generator.py # Metadata creation
│ ├── collect_29_fields.py # Extended metadata collection
│ ├── artifacts.py # Artifact management
│ ├── organize_outputs.py # Output organization
│ ├── repo_configs.py # Repository-specific configurations
│ │
│ ├── cleanup.py # Workspace cleanup
│ ├── cleanup_workspaces.py # Bulk workspace cleanup
│ ├── utils.py # Utility functions
│ ├── validate_fix.py # Fix validation
│ └── _archived/ # Legacy/deprecated code
│
├── automation_script_build_multi/ # Multi-build utilities
│ ├── README.md # Module documentation (see Documentation section)
│ ├── __init__.py
│ └── utils.py # Command execution helpers
│
├── F2P_finder/ # FAIL_TO_PASS test discovery CLI/tooling
│ ├── cli.py
│ ├── infer.py
│ └── ... # Additional finder modules
└── F2P_finder_data/ # Finder runtime/output data directory
The main orchestrator provides automated PR evaluation with test execution:
python3 -m automation_script.main_orchestrator \
https://github.com/owner/repo/pull/123 \
/path/to/workspacepython3 -m automation_script.main_orchestrator \
--language rust \
--test-cmd "cargo test --manifest-path engine/Cargo.toml" \
https://github.com/owner/repo/pull/123 \
/path/to/workspaceThe orchestrator currently runs the full evaluation workflow in one command (BASE run, test-only patch run, full patch run, and metadata generation).
# Fast mode with shallow clone
python3 -m automation_script.main_orchestrator \
--shallow-clone \
https://github.com/owner/repo/pull/123 \
/path/to/workspace
# Reuse existing Docker image
python3 -m automation_script.main_orchestrator \
--reuse-image pr-eval:base-abc123 \
https://github.com/owner/repo/pull/123 \
/path/to/workspacepython3 -m automation_script.main_orchestrator --helpBuild multi-architecture Docker images:
python3 build_universal_image.py \
--dockerfile <path-to-dockerfile> \
--output <output.tar> \
--repo_url <git-repo-url> \
--commit <commit-sha>python3 build_universal_image.py \
--dockerfile ./Dockerfile \
--output ./my-app.tar \
--repo_url https://github.com/example/my-app.git \
--commit abc123def456| Parameter | Required | Description |
|---|---|---|
--dockerfile |
Yes | Path to the Dockerfile to build |
--output |
Yes | Path for the output .tar file (OCI format) |
--repo_url |
Yes | Repository URL (passed as REPO_URL build arg) |
--commit |
Yes | Commit SHA (passed as BASE_COMMIT build arg) |
--context |
No | Build context directory (default: current directory) |
--builder-name |
No | Name of the buildx builder (default: velora-builder) |
--verbose or -v |
No | Enable verbose logging |
With custom build context:
python3 build_universal_image.py \
--dockerfile ./docker/Dockerfile.prod \
--output ./dist/image.tar \
--repo_url https://github.com/myorg/myrepo.git \
--commit $(git rev-parse HEAD) \
--context ./srcWith verbose logging:
python3 build_universal_image.py \
--dockerfile ./Dockerfile \
--output ./image.tar \
--repo_url https://github.com/example/repo.git \
--commit abc123 \
--verboseGet Help:
python3 build_universal_image.py --help-
Part 1: Build + Base Testing
- Clone repository and fetch PR references
- Detect language and test framework
- Build Docker image with all dependencies
- Run base tests (without PR changes)
- Save state for Part 2
-
Part 2: Patch + Evaluation
- Generate patch files (full, test-only, code-only)
- Verify patches apply cleanly
- Run test-patch-only tests (should FAIL)
- Run full-patch tests (should PASS)
- Categorize tests (F2P, P2P, etc.)
- Generate comprehensive metadata
- Organize outputs and artifacts
- Pre-flight Checks: Verifies Docker and Buildx are available
- Builder Setup: Creates or uses a Docker Buildx builder with docker-container driver
- Multi-Arch Build: Builds for both linux/amd64 and linux/arm64 simultaneously
- Caching: Uses local cache (
.buildx-cache/) to speed up subsequent builds - OCI Output: Creates a single universal
.tarfile containing both architectures
The output .tar file is OCI-compliant and works on any architecture:
# Load the image
docker load < my-app.tar
# Docker automatically selects the correct architecture
# - On Intel/AMD machines: uses linux/amd64 variant
# - On ARM machines (Graviton, Apple Silicon): uses linux/arm64 variant# List loaded images
docker images
# Inspect the image to see supported platforms
docker image inspect <image-name> | grep ArchitectureThe .tar file is portable and can be:
- Copied to other machines
- Uploaded to cloud storage
- Distributed to colleagues
- Imported on any Docker-compatible system
The script uses a local cache directory (.buildx-cache/) to speed up builds:
- Location:
./.buildx-cachein the working directory - Purpose: Caches layers to speed up subsequent builds
- Cleanup: Delete the directory to clear cache if needed
# Clear build cache
rm -rf .buildx-cacheYour Dockerfile should:
- Accept
REPO_URLandBASE_COMMITas build arguments:ARG REPO_URL ARG BASE_COMMIT
- Use multi-architecture compatible base images (e.g.,
ubuntu:24.04) - Avoid architecture-specific binaries unless conditionally installed
FROM ubuntu:24.04
ARG REPO_URL
ARG BASE_COMMIT
# Your build steps here
RUN apt-get update && apt-get install -y git
# Clone repository
RUN git clone "${REPO_URL}" /app
WORKDIR /app
RUN git checkout "${BASE_COMMIT}"
# Rest of your build...# Add your user to docker group
sudo usermod -aG docker $USER
# Then log out and log back in, or run:
newgrp docker# Install Docker Buildx plugin (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install docker-buildx-plugin
# Or on macOS with Homebrew:
brew install docker-buildxUse manual overrides:
python3 -m automation_script.main_orchestrator \
--language python \
--test-cmd "pytest" \
https://github.com/owner/repo/pull/123 \
/path/to/workspaceCheck logs and consider using self-healing features (automatic) or manual intervention:
# View unified workflow logs
cat /path/to/workspace/<pr_folder>/logs/workflow.log# Remove existing builder and let script recreate it
docker buildx rm multi-arch-builder
# Then run the script againThis can happen if:
- Base image doesn't support that architecture
- Architecture-specific binaries are being installed
- Solution: Check Dockerfile for architecture-specific commands
Use shallow clone:
python3 -m automation_script.main_orchestrator \
--shallow-clone \
https://github.com/owner/repo/pull/123 \
/path/to/workspace- See automation_script/README.md for detailed PR evaluation usage, supported languages, output formats, and VeloraHarness integration
- Check INSTALL.txt for detailed installation guidance
- Run scripts with
--helpflag for usage information - Review logs in workspace directory under
logs/ - Verify all prerequisites are properly installed
- Use Build Cache: The script caches layers automatically
- Parallel Builds: Both architectures build in parallel
- Network Speed: First build downloads images; subsequent builds are faster
- Use .dockerignore: Exclude unnecessary files from build context
The script builds for:
- linux/amd64: Intel and AMD x86_64 processors
- linux/arm64: ARM 64-bit processors (AWS Graviton, Apple Silicon, etc.)
To modify architectures, edit the PLATFORMS constant in the script:
PLATFORMS = "linux/amd64,linux/arm64"Q: Can I build for just one architecture?
A: Yes, modify PLATFORMS = "linux/amd64" in the script.
Q: How large will the output file be?
A: Approximately 2x the size of a single-architecture image (contains both variants).
Q: Can I push to Docker Hub instead of creating a tar file?
A: Yes, replace --output=type=oci,dest=<file> with --push and tag the image.
Q: Does this work with private registries?
A: Yes, ensure you're logged in with docker login before running.
Q: Can I add more architectures?
A: Yes, add to PLATFORMS (e.g., "linux/amd64,linux/arm64,linux/arm/v7"), but ensure base images support them.
The PR evaluation system automatically detects and supports:
- Python - pytest, unittest
- JavaScript/TypeScript - npm test, jest, mocha
- Go - go test
- Rust - cargo test
- Java - maven, gradle
- C# - dotnet test
- Ruby - rake test, rspec
If auto-detection fails, use --language and --test-cmd flags to override.
After successful PR evaluation, the workspace contains:
workspace/<pr_folder>/
├── artifacts/ # base/, test_patch_only/, pr/ test outputs
├── docker_images/ # Saved Docker image tar + generated Dockerfile
├── logs/ # Unified workflow log (workflow.log)
├── metadata/ # instance.json + swe-bench-instance.json
├── patches/ # pr.patch, test.patch, code.patch
└── repo/ # Cloned repository
DOCKER_BUILDKIT=1- Enable BuildKit (recommended)DOCKER_BUILD_JOBS- Number of parallel build jobs
Edit automation_script/config.py for:
- Docker build settings
- Timeout configurations
- Test execution parameters
- Logging preferences
When contributing:
- Follow existing code style and structure
- Test changes thoroughly with different PR types
- Update documentation for new features
- Ensure all linters pass
For issues or questions:
- See automation_script/README.md for detailed usage and troubleshooting of the PR evaluation system
- Check INSTALL.txt for installation issues
- Review Troubleshooting section above
- Run scripts with
--helpor--verboseflags - Check logs in workspace directory
- Verify all prerequisites are installed correctly
- PR Evaluation Guide: See automation_script/README.md for the full pipeline docs
- Multi-Build Utilities: See automation_script_build_multi/README.md for build helper utilities
- Installation Guide: See INSTALL.txt
- Python Dependencies: See requirements.txt
- Automated Install: Run install.sh
This tool is provided as-is for automated PR evaluation and multi-architecture Docker image building.
Happy Automating! 🚀