Skip to content

Commit 6a93e34

Browse files
authored
RHOAIENG-17695: chore(ci): disable ryuk for gha runs and when it actually fails to start (most likely due to rootless podman) (#849)
* RHOAIENG-17695: chore(ci): disable ryuk for gha runs and when it actually fails to start (most likely due to rootless podman) * fixup, change the logic to only suggest disabling Ryuk, not disabling automatically
1 parent 5349835 commit 6a93e34

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

.github/workflows/build-notebooks-TEMPLATE.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,16 +291,12 @@ jobs:
291291
- name: Run container tests (in PyTest)
292292
run: |
293293
set -Eeuxo pipefail
294-
# retry to increase CI reliability
295-
for i in {1..5}; do
296-
if podman pull --retry 10 "${RYUK_CONTAINER_IMAGE}"; then break; fi
297-
done
298-
# now run the tests
299294
poetry run pytest --capture=fd tests/containers --image="${{ steps.calculated_vars.outputs.OUTPUT_IMAGE }}"
300295
env:
301296
DOCKER_HOST: "unix:///var/run/podman/podman.sock"
302297
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: "/var/run/podman/podman.sock"
303-
RYUK_CONTAINER_IMAGE: "testcontainers/ryuk:0.8.1"
298+
# pulling the Ryuk container from docker.io introduces CI flakiness
299+
TESTCONTAINERS_RYUK_DISABLED: "true"
304300

305301
# endregion Pytest image tests
306302

tests/containers/conftest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import logging
34
import os
45
from typing import Iterable, TYPE_CHECKING
56

@@ -65,7 +66,15 @@ def pytest_sessionstart(session: Session) -> None:
6566

6667
# second preflight check: start the Reaper container
6768
if not testcontainers.core.config.testcontainers_config.ryuk_disabled:
68-
assert testcontainers.core.container.Reaper.get_instance() is not None, "Failed to start Reaper container"
69+
# when running on rootless podman, ryuk fails to start and may need to be disabled
70+
# https://java.testcontainers.org/supported_docker_environment/#podman
71+
logging.warning("Ryuk is enabled. This may not work with rootless podman.")
72+
try:
73+
assert testcontainers.core.container.Reaper.get_instance() is not None, "Failed to start Reaper container"
74+
except Exception as e:
75+
logging.exception("Failed to start the Ryuk Reaper container", exc_info=e)
76+
logging.error(f"Set env variable 'export TESTCONTAINERS_RYUK_DISABLED=true' and try again.")
77+
raise RuntimeError("Consider disabling Ryuk as per the log messages above.") from e
6978

7079

7180
# https://docs.pytest.org/en/latest/reference/reference.html#pytest.hookspec.pytest_sessionfinish

0 commit comments

Comments
 (0)