|
| 1 | +# GitHub Copilot Agent Development Environment Configuration |
| 2 | +# This file preinstalls tools and dependencies to ensure smooth agent sessions |
| 3 | +# Documentation: https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment |
| 4 | + |
| 5 | +# Preinstall script runs once when the environment is created |
| 6 | +# Set up all required tools and dependencies |
| 7 | +preinstall: | |
| 8 | + set -e |
| 9 | + |
| 10 | + echo "🔧 Setting up Hephaestus development environment..." |
| 11 | + |
| 12 | + # Install Node.js 22.10.0 (exact version from .node-version) |
| 13 | + echo "📦 Installing Node.js 22.10.0..." |
| 14 | + curl -fsSL https://deb.nodesource.com/setup_22.x | bash - |
| 15 | + apt-get install -y nodejs |
| 16 | + node --version |
| 17 | + npm --version |
| 18 | + |
| 19 | + # Install Java 21 (OpenJDK via Adoptium/Eclipse Temurin) |
| 20 | + echo "☕ Installing Java 21..." |
| 21 | + apt-get install -y wget apt-transport-https gnupg |
| 22 | + mkdir -p /etc/apt/keyrings |
| 23 | + wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc |
| 24 | + echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list |
| 25 | + apt-get update |
| 26 | + apt-get install -y temurin-21-jdk |
| 27 | + java -version |
| 28 | + |
| 29 | + # Install Python 3.13 |
| 30 | + echo "🐍 Installing Python 3.13..." |
| 31 | + apt-get install -y software-properties-common |
| 32 | + add-apt-repository -y ppa:deadsnakes/ppa |
| 33 | + apt-get update |
| 34 | + apt-get install -y python3.13 python3.13-venv python3.13-dev python3-pip |
| 35 | + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 1 |
| 36 | + python3 --version |
| 37 | + |
| 38 | + # Install Poetry 2.x for Python dependency management |
| 39 | + echo "📝 Installing Poetry 2.x..." |
| 40 | + if ! command -v poetry &> /dev/null; then |
| 41 | + curl -sSL https://install.python-poetry.org | POETRY_VERSION=2.0.0 python3 - |
| 42 | + echo 'export PATH="/root/.local/bin:$PATH"' >> ~/.bashrc |
| 43 | + else |
| 44 | + echo "Poetry already installed: $(poetry --version)" |
| 45 | + fi |
| 46 | + export PATH="/root/.local/bin:$PATH" |
| 47 | + poetry --version |
| 48 | + |
| 49 | + # Verify Docker is available (usually pre-installed in GitHub environments) |
| 50 | + echo "🐳 Checking Docker availability..." |
| 51 | + docker --version || echo "⚠️ Docker not available, some database operations may fail" |
| 52 | + |
| 53 | + # Install project npm dependencies |
| 54 | + echo "📦 Installing npm dependencies..." |
| 55 | + # Always remove node_modules to ensure a clean install |
| 56 | + if [ -d "node_modules" ]; then |
| 57 | + echo "Removing existing node_modules directory..." |
| 58 | + rm -rf node_modules |
| 59 | + fi |
| 60 | + npm ci --prefer-offline --no-audit |
| 61 | + |
| 62 | + # Bootstrap Python environments for intelligence-service and webhook-ingest |
| 63 | + echo "🔧 Bootstrapping Python environments..." |
| 64 | + if command -v poetry &> /dev/null; then |
| 65 | + npm run bootstrap:py || echo "⚠️ Poetry bootstrap failed, may need Python 3.13" |
| 66 | + else |
| 67 | + echo "⚠️ Poetry not available, skipping Python bootstrap" |
| 68 | + fi |
| 69 | + |
| 70 | + # Verify Maven wrapper is executable |
| 71 | + echo "✅ Verifying Maven wrapper..." |
| 72 | + chmod +x server/application-server/mvnw |
| 73 | + cd server/application-server && ./mvnw --version |
| 74 | + cd ../.. |
| 75 | + |
| 76 | + echo "✅ Environment setup complete!" |
| 77 | +
|
| 78 | +# Environment variables for development sessions |
| 79 | +environment: |
| 80 | + # Database connection for local development |
| 81 | + SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/hephaestus |
| 82 | + SPRING_DATASOURCE_USERNAME: root |
| 83 | + SPRING_DATASOURCE_PASSWORD: root |
| 84 | + |
| 85 | + # Intelligence service model configuration (fake provider for tooling/generation) |
| 86 | + MODEL_NAME: fake:model |
| 87 | + DETECTION_MODEL_NAME: fake:model |
| 88 | + |
| 89 | + # Add Poetry to PATH |
| 90 | + PATH: /root/.local/bin:$PATH |
0 commit comments