Skip to content

Commit

Permalink
Travis-CI: Fix Container Network (#906)
Browse files Browse the repository at this point in the history
* Travis-CI: Fix Container Network

Add `--network=host` to Travis-CI PPC64le runners.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Travis PPC64le: Move Docker Work-Around

Move the control of the work-around for docker on ppc64le on travis
into the `docker_container` logic and do not expose as interface.

* style: minor fix

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: mayeut <mayeut@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 6, 2022
1 parent 9e18cb8 commit 65c7a69
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cibuildwheel/docker_container.py
@@ -1,6 +1,7 @@
import io
import json
import os
import platform
import shlex
import subprocess
import sys
Expand All @@ -9,6 +10,8 @@
from types import TracebackType
from typing import IO, Dict, List, Optional, Sequence, Type, cast

from cibuildwheel.util import CIProvider, detect_ci_provider

from .typing import PathOrStr, PopenBytes


Expand Down Expand Up @@ -44,6 +47,15 @@ def __init__(
def __enter__(self) -> "DockerContainer":
self.name = f"cibuildwheel-{uuid.uuid4()}"
cwd_args = ["-w", str(self.cwd)] if self.cwd else []

# work-around for Travis-CI PPC64le Docker runs since 2021:
# this avoids network splits
# https://github.com/pypa/cibuildwheel/issues/904
# https://github.com/conda-forge/conda-smithy/pull/1520
network_args = []
if detect_ci_provider() == CIProvider.travis_ci and platform.machine() == "ppc64le":
network_args = ["--network=host"]

shell_args = ["linux32", "/bin/bash"] if self.simulate_32_bit else ["/bin/bash"]
subprocess.run(
[
Expand All @@ -53,6 +65,7 @@ def __enter__(self) -> "DockerContainer":
f"--name={self.name}",
"--interactive",
"--volume=/:/host", # ignored on CircleCI
*network_args,
*cwd_args,
self.docker_image,
*shell_args,
Expand Down

0 comments on commit 65c7a69

Please sign in to comment.