Skip to content

Commit 1802bf8

Browse files
authored
chore(ci): update testrunner (#15432)
This PR updates the Docker test runner environment to support Python 3.14 and fixes several issues related to build environment configuration, cache permissions, and native extensioncompilation. ### Changes #### 1. Debian Version Update - **Upgraded base image** from `debian:bookworm-slim` (GLIBC 2.36) to `debian:trixie-slim` (GLIBC 2.38) - **Reason**: Python 3.14 native extensions require GLIBC 2.38+. The previous version caused `ImportError: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.38' not found` when running testswith Python 3.14 #### 2. Python Development Headers - **Added packages**: `python3.13-dev` - **Fixes**: `fatal error: Python.h: No such file or directory` when compiling C extensions with riot - These packages ensure that Python headers are available in `/usr/include/python3.X/` for C extension compilation #### 3. Cache Directory Permissions Fix - **Updated `scripts/ddtest`** to automatically handle cache directory permissions - Detects when `.cache/` is owned by root and prompts to fix with sudo - Creates cache subdirectories (`pip`, `cython`, `sccache`) if they don't exist - **Prevents**: `PermissionError: [Errno 13] Permission denied: '/home/bits/.cache/cython'`
1 parent 1767176 commit 1802bf8

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

.claude/settings.local.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@
2727
"Skill(run-tests)",
2828
"Bash(scripts/run-tests:*)",
2929
"Bash(gh pr list:*)",
30-
"Bash(git remote:*)"
30+
"Bash(git remote:*)",
31+
"Bash(pyenv versions:*)",
32+
"Bash(pyenv virtualenv:*)",
33+
"Bash(riot -v run:*)",
34+
"Bash(mkdir:*)",
35+
"Bash(scripts/ddtest:*)",
36+
"Bash(docker compose build:*)"
3137
],
3238
"deny": []
3339
}

.claude/skills/run-tests/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ scripts/run-tests --venv flask_py311 -- -vv -k test_view_called_twice
260260
### Docker services won't start
261261
```bash
262262
# Manually check/stop services:
263-
docker-compose ps
264-
docker-compose down
263+
docker compose ps
264+
docker compose down
265265
```
266266

267267
### Can't find matching suites

.github/workflows/generate-package-versions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ jobs:
6464
run: |
6565
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
6666
sudo chmod +x /usr/local/bin/docker-compose
67-
docker-compose --version
67+
docker compose --version
6868
6969
- name: Start docker service
70-
run: docker-compose up -d testagent
70+
run: docker compose up -d testagent
7171

7272
- name: Install system dependencies
7373
run: |

docker/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# DEV: Use `debian:slim` instead of an `alpine` image to support installing wheels from PyPI
22
# this drastically improves test execution time since python dependencies don't all
33
# have to be built from source all the time (grpcio takes forever to install)
4-
FROM debian:bookworm-slim
4+
# Note: Using trixie for GLIBC 2.38+ support (required for Python 3.14 native extensions)
5+
FROM debian:trixie-slim
56

67
ARG TARGETARCH
78
ARG HATCH_VERSION=1.14.2
@@ -22,7 +23,7 @@ RUN useradd -ms /bin/bash bits
2223
RUN apt-get update \
2324
&& apt-get install -y --no-install-recommends ca-certificates curl gnupg \
2425
&& curl https://mariadb.org/mariadb_release_signing_key.pgp | gpg --dearmor > /etc/apt/trusted.gpg.d/mariadb.gpg \
25-
&& echo "deb [arch=amd64,arm64] https://mirror.mariadb.org/repo/11.rolling/debian/ bookworm main" > /etc/apt/sources.list.d/mariadb.list \
26+
&& echo "deb [arch=amd64,arm64] https://mirror.mariadb.org/repo/11.rolling/debian/ trixie main" > /etc/apt/sources.list.d/mariadb.list \
2627
&& apt-get update \
2728
&& apt-get install -y --no-install-recommends \
2829
apt-transport-https \
@@ -48,6 +49,7 @@ RUN apt-get update \
4849
libsqlite3-dev \
4950
libsqliteodbc \
5051
libssh-dev \
52+
python3.13-dev \
5153
nodejs \
5254
npm \
5355
patch \
@@ -58,6 +60,7 @@ RUN apt-get update \
5860
awscli \
5961
# Install azure-functions-core-tools-4, only supported on amd64 architecture for Linux
6062
# https://github.com/Azure/azure-functions-core-tools/issues/3112
63+
# Note: Using bookworm repo as trixie is not yet available
6164
&& if [ "$TARGETARCH" = "amd64" ]; \
6265
then \
6366
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg \

scripts/ddtest

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@ then
99
CMD=bash
1010
fi
1111

12+
# Ensure cache directories exist and are writable by the current user
13+
# These are mounted into the Docker container at /home/bits/.cache
14+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
16+
CACHE_DIR="$PROJECT_ROOT/.cache"
17+
18+
# Create cache directories if they don't exist
19+
mkdir -p "$CACHE_DIR/pip" "$CACHE_DIR/cython" "$CACHE_DIR/sccache" 2>/dev/null || true
20+
21+
# Fix permissions if the cache directory is owned by root
22+
if [ -d "$CACHE_DIR" ] && [ "$(stat -c '%U' "$CACHE_DIR" 2>/dev/null || stat -f '%Su' "$CACHE_DIR" 2>/dev/null)" = "root" ]; then
23+
echo "Warning: $CACHE_DIR is owned by root. Attempting to fix permissions..."
24+
echo "You may be prompted for your sudo password."
25+
sudo chown -R "$USER:$(id -gn)" "$CACHE_DIR" 2>/dev/null || {
26+
echo "Error: Failed to fix cache directory permissions."
27+
echo "Please run: sudo chown -R \$USER:\$(id -gn) $CACHE_DIR"
28+
exit 1
29+
}
30+
fi
31+
32+
# Ensure the directories are writable
33+
chmod -R u+w "$CACHE_DIR" 2>/dev/null || true
34+
1235
docker compose run \
1336
-e DD_TRACE_AGENT_URL \
1437
--rm \

0 commit comments

Comments
 (0)