Skip to content

Commit d7f977d

Browse files
Work around tox-docker KeyError on Docker 29+ (#3045)
## Description Added `TOX_DOCKER_GATEWAY` environment variable to the test workflow to work around a `KeyError: 'Gateway'` failure in tox-docker when running on Docker 29+. Docker 29 [removed the deprecated top-level `NetworkSettings.Gateway` key](https://docs.docker.com/engine/release-notes/29/) from the container inspect API. tox-docker 5.0.0 relies on this key and crashes with a `KeyError`. Setting `TOX_DOCKER_GATEWAY=0.0.0.0` bypasses the broken lookup entirely. This became flaky starting Feb 12 as the [Docker 29 rollout](actions/runner-images#13474) to GitHub Actions runners progresses. Once complete, tests will fail 100% of the time without this fix. This workaround can be removed once [tox-docker merges the fix](tox-dev/tox-docker#196). Mirrors the fix applied in [library-registry#862](ThePalaceProject/library-registry#862). ## Motivation and Context CI test runs are failing intermittently with: ``` tox_docker/plugin.py, line 53, in get_gateway_ip ip = container.attrs["NetworkSettings"]["Gateway"] or "0.0.0.0" KeyError: 'Gateway' ``` ## How Has This Been Tested? - CI will validate that tests pass with the workaround on Docker 29+ runners ## Checklist - [x] I have updated the documentation accordingly. - [x] All new and existing tests passed.
1 parent 0862033 commit d7f977d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ jobs:
4646

4747
- name: Run Tests
4848
run: tox
49+
env:
50+
# Workaround for tox-docker not supporting Docker 29+, which removed
51+
# the top-level NetworkSettings.Gateway key from the container API.
52+
# This can be removed once tox-docker merges the fix.
53+
# Docker 29 rollout: https://github.com/actions/runner-images/issues/13474
54+
# tox-docker fix: https://github.com/tox-dev/tox-docker/pull/196
55+
TOX_DOCKER_GATEWAY: "0.0.0.0"
4956

5057
- name: Upload coverage to Codecov
5158
uses: codecov/codecov-action@v5

0 commit comments

Comments
 (0)