-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-runner.sh
More file actions
executable file
·40 lines (30 loc) · 1.19 KB
/
run-runner.sh
File metadata and controls
executable file
·40 lines (30 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# Helper script to run multiple GitHub runners
# Usage: ./run-runner.sh [runner-id]
# Example: ./run-runner.sh 2
set -e
RUNNER_ID=${1:-1}
CONTAINER_NAME="github-runner-${RUNNER_ID}"
RUNNER_NAME="runner-${RUNNER_ID}"
echo "Starting GitHub Runner: ${RUNNER_NAME}"
echo "Container name: ${CONTAINER_NAME}"
echo ""
# Export variables for docker-compose
export CONTAINER_NAME="${CONTAINER_NAME}"
export RUNNER_NAME="${RUNNER_NAME}"
# Check if .env exists and source other variables
if [ -f .env ]; then
export $(grep -v '^#' .env | grep -v '^CONTAINER_NAME' | grep -v '^RUNNER_NAME' | xargs)
# Extract GitHub username from GITHUB_URL and append to RUNNER_LABELS
GITHUB_USER=$(echo $GITHUB_URL | sed -E 's|https://github.com/([^/]+).*|\1|')
export RUNNER_LABELS="${RUNNER_LABELS:-self-hosted,Linux,ARM64,amazonlinux},${GITHUB_USER}"
echo "Detected GitHub username: ${GITHUB_USER}"
echo "Runner labels: ${RUNNER_LABELS}"
echo ""
fi
# Start the runner
docker compose up -d
echo ""
echo "Runner '${RUNNER_NAME}' started in container '${CONTAINER_NAME}'"
echo "Use 'docker logs -f ${CONTAINER_NAME}' to view logs"
echo "Use 'docker stop ${CONTAINER_NAME}' to stop this runner"