Skip to content

feat: implement trait-based container actions architecture #9

feat: implement trait-based container actions architecture

feat: implement trait-based container actions architecture #9

---
name: E2E Configuration Tests
# This workflow tests ONLY software configuration, release, and run phases
# using Docker containers. It does NOT test infrastructure provisioning
# (VMs/containers creation) as that is handled by the E2E Provision Tests
# workflow.
#
# This workflow uses Docker containers instead of LXD VMs to avoid GitHub
# Actions network connectivity issues within VMs that prevent software
# installation.
#
# NETWORK TUNING: We use smorimoto/tune-github-hosted-runner-network to fix
# flaky networking issues that cause Docker GPG key downloads to fail
# intermittently in GitHub Actions.
# See: https://github.com/actions/runner-images/issues/1187 and
# https://github.com/actions/runner-images/issues/2890
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
workflow_dispatch: {} # Allow manual triggering
jobs:
e2e-config-tests:
runs-on: ubuntu-latest
timeout-minutes: 45 # Timeout for complete configuration testing with software installation
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Tune GitHub hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install Ansible
run: ./scripts/setup/install-ansible.sh
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Verify installations
run: |
docker --version
ansible --version
cargo --version
- name: Set SSH key permissions
run: |
# SSH requires private key files to have restrictive permissions (0600)
# Git checkout doesn't preserve file permissions, so we need to set them manually
chmod 600 fixtures/testing_rsa
ls -la fixtures/testing_rsa
- name: Build E2E configuration tests binary
run: |
cargo build --bin e2e-config-tests --release
- name: Run E2E configuration test
run: |
# Run the E2E configuration test with debug logging for better debugging
echo "🚀 Starting E2E configuration test at $(date)"
cargo run --bin e2e-config-tests
echo "✅ E2E configuration test completed at $(date)"
env:
# Preserve environment variables for the E2E test
RUST_LOG: debug
- name: Get test outputs (on success)
if: success()
run: |
echo "=== Docker Containers ==="
docker ps -a || echo "No containers found"
echo "=== Docker Images ==="
docker images || echo "No images found"
- name: Debug information (on failure)
if: failure()
run: |
echo "=== Docker Status ==="
docker ps -a || echo "Docker ps failed"
echo "=== Docker Logs ==="
# Get logs from any containers that might still be running
for container in $(docker ps -aq 2>/dev/null || true); do
echo "=== Logs for container $container ==="
docker logs "$container" 2>/dev/null || echo "Could not get logs for container $container"
done
echo "=== System Resources ==="
df -h
free -h
echo "=== Recent logs ==="
sudo journalctl --since "10 minutes ago" --no-pager | tail -50 || echo "Journal logs not available"
- name: Cleanup containers (always run)
if: always()
run: |
echo "Cleaning up test containers..."
# Clean up any remaining containers from the test
docker ps -aq | xargs -r docker rm -f || echo "No containers to remove"
# Clean up any test images if needed
docker images --filter "reference=torrust-provisioned-instance*" -q | xargs -r docker rmi -f || echo "No test images to remove"
- name: Final verification
if: always()
run: |
echo "Verifying final cleanup..."
docker ps -a
echo "=== Test Summary ==="
echo "E2E configuration test workflow completed"
if [ "${{ job.status }}" = "success" ]; then
echo "✅ All configuration tests passed successfully"
else
echo "❌ Some configuration tests failed - check logs above"
fi