File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ pip install -e '.[dev]'
1111pre-commit install
1212```
1313
14+ Make sure you have ` GITHUB_TOKEN ` (w/ access permissions for this organization) set in a ` .env ` file
15+
1416### Usage
1517
1618To run ` n ` rounds of 2+ models competing against one another on a game, run the following:
Original file line number Diff line number Diff line change @@ -60,7 +60,10 @@ def build_image(self):
6060
6161 # Build the Docker image
6262 result = subprocess .run (
63- f"docker build -t { self .image_name } -f docker/{ self .name } .Dockerfile ." ,
63+ (
64+ "export $(cat .env | xargs);"
65+ f"docker build --build-arg GITHUB_TOKEN=$GITHUB_TOKEN -t { self .image_name } -f docker/{ self .name } .Dockerfile ."
66+ ),
6467 shell = True ,
6568 capture_output = True ,
6669 text = True ,
@@ -71,7 +74,7 @@ def build_image(self):
7174 self .logger .error (
7275 f"❌ Failed to build Docker image: { result .stderr } \n { result .stdout } { result .stderr } "
7376 )
74- raise
77+ raise RuntimeError ( f"Failed to build Docker image: { result . stderr } " )
7578
7679 def end (self , cleanup : bool = False ):
7780 self .logger .info (Counter ([x [1 ] for x in self .scoreboard ]))
Original file line number Diff line number Diff line change @@ -5,8 +5,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
55 build-essential git curl && \
66 rm -rf /var/lib/apt/lists/*
77
8- RUN git clone https://github.com/emagedoc/BattleCode.git /testbed
9-
8+ ARG GITHUB_TOKEN
9+ RUN git clone https://${GITHUB_TOKEN}@github.com/emagedoc/BattleCode.git /testbed \
10+ && cd /testbed \
11+ && git remote set-url origin https://github.com/emagedoc/BattleCode.git \
12+ && unset GITHUB_TOKEN
1013WORKDIR /testbed
1114
12- RUN python run.py update
15+ RUN python run.py update
Original file line number Diff line number Diff line change @@ -18,7 +18,12 @@ RUN ARCH=$(dpkg --print-architecture) && \
1818 tar -C /usr/local -xzf /tmp/go.tar.gz && \
1919 rm /tmp/go.tar.gz
2020
21- RUN git clone https://github.com/emagedoc/BattleSnake.git /testbed
21+ # Inject GitHub token for private repo access
22+ ARG GITHUB_TOKEN
23+ RUN git clone https://${GITHUB_TOKEN}@github.com/emagedoc/BattleSnake.git /testbed \
24+ && cd /testbed \
25+ && git remote set-url origin https://github.com/emagedoc/BattleSnake.git \
26+ && unset GITHUB_TOKEN
2227
2328WORKDIR /testbed
2429
Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ RUN apt-get update \
55 curl ca-certificates wget git build-essential jq curl locales \
66 && rm -rf /var/lib/apt/lists/*
77
8- RUN git clone https://github.com/emagedoc/CoreWar.git /testbed
8+ ARG GITHUB_TOKEN
9+ RUN git clone https://${GITHUB_TOKEN}@github.com/emagedoc/CoreWar.git /testbed \
10+ && cd /testbed \
11+ && git remote set-url origin https://github.com/emagedoc/CoreWar.git \
12+ && unset GITHUB_TOKEN
913
1014WORKDIR /testbed
1115
Original file line number Diff line number Diff line change 1111unzip \
1212&& rm -rf /var/lib/apt/lists/*
1313
14- RUN git clone https://github.com/emagedoc/RoboCode.git testbed
14+ ARG GITHUB_TOKEN
15+ RUN git clone https://${GITHUB_TOKEN}@github.com/emagedoc/RoboCode.git /testbed \
16+ && cd /testbed \
17+ && git remote set-url origin https://github.com/emagedoc/RoboCode.git \
18+ && unset GITHUB_TOKEN
1519
16- WORKDIR /testbed
20+ WORKDIR /testbed
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ RUN apt-get update \
99 python3-pip python-is-python3 wget git build-essential jq curl locales \
1010 && rm -rf /var/lib/apt/lists/*
1111
12- RUN git clone https://github.com/emagedoc/RobotRumble.git /testbed
12+ ARG GITHUB_TOKEN
13+ RUN git clone https://${GITHUB_TOKEN}@github.com/emagedoc/RobotRumble.git /testbed \
14+ && cd /testbed \
15+ && git remote set-url origin https://github.com/emagedoc/RobotRumble.git \
16+ && unset GITHUB_TOKEN
1317
1418WORKDIR /testbed
You can’t perform that action at this time.
0 commit comments