Skip to content

Commit dd17a02

Browse files
author
Daniel Schlör
committed
path fix to actually include versioning
1 parent e858750 commit dd17a02

File tree

2 files changed

+38
-91
lines changed

2 files changed

+38
-91
lines changed

docker-entrypoint.sh

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
# Configuration
55
DATA_REPO_URL="${DATA_REPO_URL:-https://github.com/LSX-UniWue/brace-ctf-data.git}"
6-
DATA_BRANCH="${DATA_BRANCH:-main}"
6+
DATA_REF="${DATA_REF:-${DATA_BRANCH:-main}}" # Support both DATA_REF and legacy DATA_BRANCH
77
DATA_DIR="/home/agent/data"
88
SKIP_DATA_CLONE="${SKIP_DATA_CLONE:-false}"
99

@@ -26,26 +26,58 @@ else
2626
echo "No authentication token found. Assuming public repository."
2727
fi
2828

29-
# If data directory exists and is a git repo, pull latest
29+
# If data directory exists and is a git repo, update it
3030
if [ -d "$DATA_DIR/.git" ]; then
3131
echo "📦 Updating existing data repository..."
3232
cd "$DATA_DIR"
33-
git fetch origin
34-
git reset --hard "origin/$DATA_BRANCH"
33+
git fetch origin --tags
34+
# Check if DATA_REF is a tag or branch
35+
if git show-ref --tags "refs/tags/$DATA_REF" > /dev/null 2>&1; then
36+
echo "Checking out tag: $DATA_REF"
37+
git checkout "tags/$DATA_REF"
38+
else
39+
echo "Checking out branch: $DATA_REF"
40+
git reset --hard "origin/$DATA_REF"
41+
fi
3542
cd /home/agent
3643
else
3744
# Clone fresh
3845
echo "📥 Cloning data repository..."
3946
rm -rf "$DATA_DIR"
40-
if ! git clone --depth 1 --branch "$DATA_BRANCH" "$AUTH_DATA_REPO_URL" "$DATA_DIR"; then
47+
if ! git clone --depth 1 --branch "$DATA_REF" "$AUTH_DATA_REPO_URL" "$DATA_DIR"; then
4148
echo "❌ Error: Failed to clone data repository from $AUTH_DATA_REPO_URL"
42-
echo " Please ensure the repository exists and is accessible, and that DATA_REPO_URL and DATA_BRANCH are correct."
49+
echo " Please ensure the repository exists and is accessible, and that DATA_REPO_URL and DATA_REF are correct."
4350
echo " If it's a private repository, ensure GITHUB_TOKEN or an embedded token is provided."
4451
exit 1
4552
fi
4653
fi
4754

55+
# Capture commit information for evaluation tracking
56+
cd "$DATA_DIR"
57+
DATA_COMMIT_SHA=$(git rev-parse HEAD)
58+
DATA_COMMIT_SHORT=$(git rev-parse --short HEAD)
59+
DATA_COMMIT_DESCRIBE=$(git describe --tags --always 2>/dev/null || echo "$DATA_COMMIT_SHORT")
60+
DATA_COMMIT_DATE=$(git log -1 --format=%ci)
61+
62+
# Extract repo owner and name from URL for condensed identifier
63+
REPO_PATH=$(echo "$DATA_REPO_URL" | sed -E 's|.*github\.com[/:]([^/]+/[^/.]+)(\.git)?.*|\1|')
64+
DATA_VERSION_FULL="${REPO_PATH}@${DATA_COMMIT_DESCRIBE}"
65+
66+
cd /home/agent
67+
68+
# Export as environment variables for the application to use
69+
export DATA_REPO_URL
70+
export DATA_COMMIT_SHA
71+
export DATA_COMMIT_SHORT
72+
export DATA_COMMIT_DESCRIBE
73+
export DATA_COMMIT_DATE
74+
export DATA_VERSION="$DATA_COMMIT_DESCRIBE"
75+
export DATA_VERSION_FULL
76+
4877
echo "✅ Data repository ready!"
78+
echo "📍 Data Version: $DATA_VERSION_FULL"
79+
echo " Commit SHA: $DATA_COMMIT_SHA"
80+
echo " Commit Date: $DATA_COMMIT_DATE"
4981
echo ""
5082

5183
# Execute the server with provided arguments

src/docker-entrypoint.sh

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)