Skip to content

Singularity support#97

Open
sbdzdz wants to merge 16 commits intoCodeClash-ai:mainfrom
sbdzdz:singularity-support
Open

Singularity support#97
sbdzdz wants to merge 16 commits intoCodeClash-ai:mainfrom
sbdzdz:singularity-support

Conversation

@sbdzdz
Copy link

@sbdzdz sbdzdz commented Feb 13, 2026

Singularity Support

Add Singularity support. All test pass, all arenas run with dummy agents, the Docker path remains almost unchanged. It would be great to test with some actual API calls.

Core changes

  • Add SingularityEnvironment support to environment.py.
  • Add .def files for all 16 arenas.
  • Allow tar exit code 1 in pvp.py ("file changed" warning can happen on weka with Singularity).
  • Update README.md to mention Singularity as an alternative to Docker.

Arena-specific fixes

  • Singularity's --cleanenv clears environment variables set during %post, breaking tools that rely on $HOME.

    • Halite/Halite2/Halite3: Set RUSTUP_HOME=/root/.rustup and CARGO_HOME=/root/.cargo in %environment.
    • BattleCode23/BattleCode24: Set GRADLE_USER_HOME=/root/.gradle in %environment.
  • Singularity's --contain flag clears /tmp and /home after each execute() invocation.

    • BattleCode23/BattleCode24: Move compiled class storage from /tmp to /opt.
    • CoreWar: Move dwarf.red from /home to /opt (both in .def and .py).
    • arena.py: Use local git config instead of global (which writes to ~/.gitconfig).
  • SingularityEnvironment.execute() captures stderr and stdout together, polluting command output.

    • Halite, RobotRumble: Extract the last line, with a guard for empty output.
    • player.py: Same fix for git rev-parse HEAD output.
    • git_utils.py: Discard all lines before the first diff header (git diff tag1..tag2 never produces a prelude).
  • Singularity's background processes don't persist across execute() calls.

    • BattleSnake: Use subprocess.Popen to start player HTTP servers.
  • Singularity sandbox directories can contain symlinks that don't resolve on the host.

    • environment.py: Pass symlinks=True to shutil.copytree in copy_between_containers.

Test fixes

  • tests/conftest.py: Auto-detect container runtime.
  • tests/arenas/test_corewar.py: Update mock command paths from /home/dwarf.red to /opt/dwarf.red.
  • codeclash/arenas/figgie/figgie.py: Move player count validation before attempting to build the container image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant