Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions .github/workflows/black-box.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,31 @@ jobs:
with:
go-version-file: ${{ inputs.go-version-file }}

- name: Install podman-compose
# Do not install Podman: compose service_healthy needs healthchecks that
# actually run. Dockerd does that. Podman relies on systemd user timers
# that often never fire on GHA (stuck starting / Log=null).
# See: https://github.com/podman-container-tools/podman/pull/27033
# Prefer docker when both exist on the runner.
- name: Detect container engine
run: |
sudo apt-get update
sudo apt-get install -y podman
pip install podman-compose==1.6.0
sudo loginctl enable-linger "$(id -un)"
timeout 30 bash -c 'until [ -d /run/user/$(id -u) ]; do sleep 0.5; done'
echo "XDG_RUNTIME_DIR=/run/user/$(id -u)" >> "$GITHUB_ENV"
if command -v docker >/dev/null 2>&1; then
engine=docker
elif command -v podman >/dev/null 2>&1; then
engine=podman
Comment on lines +44 to +47

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Podman fallback unprepared 🐞 Bug ☼ Reliability

The workflow can fall back to Podman when Docker is missing, but it no longer sets up a
Podman-capable runtime environment before later steps use $CONTAINER_ENGINE, so Podman-only runners
can fail when pulling images or collecting diagnostics. Additionally, the diagnostics step defaults
to docker when CONTAINER_ENGINE is unset, which can yield misleading or empty output in
non-Docker environments.
Agent Prompt
## Issue description
The workflow contains a Podman fallback path, but it no longer performs the necessary Podman preparation/validation before subsequent steps invoke the selected container engine (e.g., pulls and diagnostics). Separately, the diagnostics step silently defaults to `docker` when `CONTAINER_ENGINE` is unset, which can produce misleading/empty diagnostics on non-Docker runners.

## Issue Context
This reusable workflow runs on `ubuntu-latest` and includes engine-detection logic that can select Podman when Docker is missing. If the Podman branch is kept, the workflow should either ensure Podman works equivalently to the Docker path (including any required setup/validation) or fail fast with a clear error; diagnostics should not independently default to Docker when the engine is unknown, and should instead reuse detection or require a previously-determined engine.

## Fix Focus Areas
- .github/workflows/black-box.yaml[42-66]
- .github/workflows/black-box.yaml[74-99]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

else
echo "No docker or podman found on the runner" >&2
exit 1
fi
echo "CONTAINER_ENGINE=$engine" >> "$GITHUB_ENV"
echo "Using CONTAINER_ENGINE=$engine"
"$engine" version

- name: Pre-pull container images
if: inputs.images != ''
run: |
for img in ${{ inputs.images }}; do
for i in 1 2 3; do
podman pull "$img" && break
"$CONTAINER_ENGINE" pull "$img" && break
[ $i -eq 3 ] && exit 1
echo "Pull failed, retrying in 15s..."
sleep 15
Expand All @@ -66,23 +76,25 @@ jobs:
continue-on-error: true
run: |
set +e
echo "::group::podman ps -a"
podman ps -a
engine="${CONTAINER_ENGINE:-docker}"

echo "::group::${engine} ps -a"
"$engine" ps -a
echo "::endgroup::"

echo "::group::container health"
for c in $(podman ps -aq 2>/dev/null); do
name=$(podman inspect --format '{{.Name}}' "$c" 2>/dev/null || echo "$c")
for c in $("$engine" ps -aq 2>/dev/null); do
name=$("$engine" inspect --format '{{.Name}}' "$c" 2>/dev/null || echo "$c")
echo "--- $name ---"
podman inspect --format '{{json .State.Health}}' "$c"
"$engine" inspect --format '{{json .State.Health}}' "$c"
done
echo "::endgroup::"

echo "::group::container logs"
for c in $(podman ps -aq 2>/dev/null); do
name=$(podman inspect --format '{{.Name}}' "$c" 2>/dev/null || echo "$c")
for c in $("$engine" ps -aq 2>/dev/null); do
name=$("$engine" inspect --format '{{.Name}}' "$c" 2>/dev/null || echo "$c")
echo "--- $name ---"
podman logs --tail 200 "$c"
"$engine" logs --tail 200 "$c"
done
echo "::endgroup::"

Expand Down