Skip to content

Commit b816508

Browse files
sbuerknhovratov
authored andcommitted
[TASK] Run CI containers with docker
GitHub hosted runners ship both podman and docker. Their podman/crun combination intermittently aborts the first container start of a job with "OCI runtime error: crun: unknown version specified" (exit code 126). It hits any job, so which ones fail varies per run, and a rerun on another host usually clears it. runTests.sh prefers podman whenever it is present and only falls back to docker. That default is correct for the script and is kept, since podman-only machines are exactly what it is built for. The hosted runners are the single place these workflows meet the broken combination, so the override belongs in the workflow: every "runTests.sh" call passes "-b docker" now, with the reasoning noted in the workflow header so the flag can be dropped knowingly later. Selecting docker exposes a second defect that podman masks. docker runs the container as "--user $HOST_UID" with group 0, while the functional sqlite tmpfs inherits the mode of its host mountpoint -- 0755 and owned by root at the umask a runner uses. No test database can be created then and every functional sqlite test fails with "unable to open database file". Rootless podman is root inside its user namespace and passes no "--user", which is why this never showed before. The tmpfs is mounted with "mode=1777" now, which docker needs and podman does not mind.
1 parent c156e34 commit b816508

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
name: Tests
2+
3+
# Every "runTests.sh" call below passes "-b docker". The script prefers podman
4+
# whenever it is present and only falls back to docker, which is the right
5+
# default for it -- but GitHub hosted runners ship both, and their podman/crun
6+
# combination aborts the first container start of a job with "OCI runtime error:
7+
# crun: unknown version specified" (exit code 126). It is intermittent and hits
8+
# any job. Selecting docker here avoids crun entirely and leaves the script
9+
# default and local runs untouched. Drop the flag once GitHub stops producing
10+
# the mismatch.
11+
212
on:
313
push:
414
branches:
@@ -41,10 +51,10 @@ jobs:
4151
run: composer update --no-progress
4252

4353
- name: PHP CS Fixer
44-
run: Build/Scripts/runTests.sh -p 8.2 -s cgl -n
54+
run: Build/Scripts/runTests.sh -b docker -p 8.2 -s cgl -n
4555

4656
- name: PHP CS Fixer Header
47-
run: Build/Scripts/runTests.sh -p 8.2 -s cglHeader -n
57+
run: Build/Scripts/runTests.sh -b docker -p 8.2 -s cglHeader -n
4858

4959
- name: Content Blocks Lint
5060
run: .Build/bin/typo3 content-blocks:lint
@@ -79,7 +89,7 @@ jobs:
7989
run: composer update --prefer-dist --prefer-stable --no-progress
8090

8191
- name: Unit
82-
run: Build/Scripts/runTests.sh -s unit -p ${{ matrix.php }}
92+
run: Build/Scripts/runTests.sh -b docker -s unit -p ${{ matrix.php }}
8393

8494
functional_tests:
8595
name: Functional Tests TYPO3 v14 PHP ${{ matrix.php }}
@@ -111,7 +121,7 @@ jobs:
111121
run: composer update --prefer-stable --no-progress
112122

113123
- name: Functional
114-
run: Build/Scripts/runTests.sh -s functional -d sqlite -p ${{ matrix.php }}
124+
run: Build/Scripts/runTests.sh -b docker -s functional -d sqlite -p ${{ matrix.php }}
115125

116126
PHPStan:
117127
name: PHPStan TYPO3 v14 PHP 8.5

Build/Scripts/runTests.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,14 @@ case ${TEST_SUITE} in
11041104
sqlite)
11051105
# create sqlite tmpfs mount typo3temp/var/tests/functional-sqlite-dbs/ to avoid permission issues
11061106
mkdir -p "${CORE_ROOT}/typo3temp/var/tests/functional-sqlite-dbs/"
1107-
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_sqlite --tmpfs ${CORE_ROOT}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid"
1107+
# "mode=1777" is required for docker and harmless for podman: docker runs
1108+
# the container as "--user $HOST_UID" with group 0, while the tmpfs inherits
1109+
# the mode of its host mountpoint -- 0755 and owned by root at the umask a
1110+
# runner uses. The test databases cannot be created then and every test fails
1111+
# with "unable to open database file". Rootless podman is root inside its
1112+
# user namespace and passes no "--user", which is why this only shows with
1113+
# docker.
1114+
CONTAINERPARAMS="-e typo3DatabaseDriver=pdo_sqlite --tmpfs ${CORE_ROOT}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid,mode=1777"
11081115
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name functional-${SUFFIX} ${XDEBUG_MODE} -e XDEBUG_CONFIG="${XDEBUG_CONFIG}" ${CONTAINERPARAMS} ${IMAGE_PHP} "${COMMAND[@]}"
11091116
SUITE_EXIT_CODE=$?
11101117
;;

0 commit comments

Comments
 (0)