Skip to content

Commit 4be7246

Browse files
committed
Token Fetcher
1 parent 832f21e commit 4be7246

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ RUN apt-get update && apt-get install -y \
2121
gdb-multiarch \
2222
wget \
2323
jimsh \
24-
libjim-dev
24+
libjim-dev \
25+
jq
26+
2527

2628
RUN python -m pip install gatorgrade
2729

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ services:
22
gdbuddy:
33
image: ghcr.io/bare-metal-edu/gdbuddy:latest
44
environment:
5-
RUNNER_ORG:
6-
RUNNER_TOKEN:
5+
RUNNER_ORG: https://github.com/bare-metal-edu
6+
GITHUB_PAT: ${GITHUB_PAT}
77
privileged: true
88
devices:
99
- "/dev/ttyACM0:/dev/ttyACM0"

entrypoint.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
#/bin/sh
22

3+
set -e
4+
5+
# Extract org from URL
6+
ORG_NAME=$(echo "$RUNNER_ORG" | awk -F/ '{print $NF}')
7+
8+
# Fetch the runner registration Token from GitHub API
9+
RUNNER_TOKEN=$(curl -s -X POST /
10+
-H "Authorization: Bearer $GITHUB_PAT" \
11+
-H "Accept: application/vnd.github+json" \
12+
"https://api.github.com/orgs/$ORG_NAME/actions/runners/registration-token" | jq -r .token)
13+
314
cd /runner && \
4-
./config.sh --url $RUNNER_ORG --token $RUNNER_TOKEN &&
15+
./config.sh --url "$RUNNER_ORG" --token "$RUNNER_TOKEN" &&
516
./run.sh &
617

718
/tools/openocd/src/openocd -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s /tools/openocd/tcl -f /tools/openocd-helpers.tcl -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000"
19+
20+

0 commit comments

Comments
 (0)