From 802a7f04a55e8b6511eefc2d2f17576992c26e49 Mon Sep 17 00:00:00 2001 From: Tim DiLauro Date: Mon, 23 Nov 2026 15:51:01 -0500 Subject: [PATCH] Add `disable-network-offload` for GitHub action runners (PP-5633) --- .../test-disable-network-offload.yml | 41 +++++++++++++++++++ README.md | 19 +++++++++ disable-network-offload/action.yml | 21 ++++++++++ 3 files changed, 81 insertions(+) create mode 100644 .github/workflows/test-disable-network-offload.yml create mode 100644 disable-network-offload/action.yml diff --git a/.github/workflows/test-disable-network-offload.yml b/.github/workflows/test-disable-network-offload.yml new file mode 100644 index 0000000..31e93b8 --- /dev/null +++ b/.github/workflows/test-disable-network-offload.yml @@ -0,0 +1,41 @@ +name: Test disable-network-offload + +on: + pull_request: + paths: + - "disable-network-offload/**" + - ".github/workflows/test-disable-network-offload.yml" + push: + branches: [main] + paths: + - "disable-network-offload/**" + - ".github/workflows/test-disable-network-offload.yml" + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, ubuntu-24.04] + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Disable network offload + uses: ./disable-network-offload + + - name: Check that TX and RX checksum offload are off + run: | + iface="$(ip -o route show default | awk '{print $5; exit}')" + features="$(ethtool -k "$iface")" + echo "$features" + failed=0 + for feature in rx-checksumming tx-checksumming; do + if ! grep -Eq "^${feature}: off" <<<"$features"; then + echo "::error::Expected ${feature} to be off on ${iface}." + failed=1 + fi + done + exit "$failed" diff --git a/README.md b/README.md index b77e1b8..13bd47c 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,25 @@ Inputs: `version`, `cache`, `cache-restore-only`, `cache-name`. Outputs: `version`, `home`, `cache-dir`. See [`poetry/action.yml`](poetry/action.yml) for the full schema. +### `disable-network-offload` + +Turns off TX and RX checksum offload on the runner's network interface. This +works around network failures in Docker builds on GitHub-hosted runners (see +[actions/runner-images#1187](https://github.com/actions/runner-images/issues/1187#issuecomment-686735760)). + +The action finds the interface from the default route, so it does not depend on +the interface name (for example, `eth0`). It prints the interface list first, to +help debug failures. It fails with a clear error if there is no default route. + +```yaml +- name: Disable network offload + uses: ThePalaceProject/github-actions/disable-network-offload@v1 +``` + +No inputs or outputs. Use it only on GitHub-hosted Linux runners. It uses `ip`, +`ethtool`, and `sudo`. It also expects the default route to have a gateway +(`default via dev `), as GitHub-hosted runners do. + ### `jira-release-sync` On a published GitHub release, creates a matching Jira version, links the diff --git a/disable-network-offload/action.yml b/disable-network-offload/action.yml new file mode 100644 index 0000000..510ad95 --- /dev/null +++ b/disable-network-offload/action.yml @@ -0,0 +1,21 @@ +name: 'Disable network offload' +description: 'Turn off TX and RX checksum offload on the runner network interface' + +# See comment here: https://github.com/actions/runner-images/issues/1187#issuecomment-686735760 +# Do not hard-code eth0. Some runner images may give the network interface a different name, +# so use the interface on the default route. The interface list helps debug failures. +# Use this action only on GitHub-hosted runners. The awk field number expects a default +# route with a gateway ("default via dev "). +runs: + using: "composite" + steps: + - run: | + ip -o link + iface="$(ip -o route show default | awk '{print $5; exit}')" + if [ -z "$iface" ]; then + echo "::error::No network interface found on the default route." + exit 1 + fi + echo "Using interface: $iface" + sudo ethtool -K "$iface" tx off rx off + shell: bash