Skip to content

Commit 0787a44

Browse files
authored
fix: enforce minimum version of docker/podman (#1961)
* fix: enforce minimum version of docker/podman This allows to always pass `--platform` to the OCI engine thus fixing issues with multiarch images. * Allow older versions with warnings * Upgrade docker on Travis CI * fix: use `docker cp` instead of `tar` * Enforce docker>=24.0 * move log to include container.copy_into * fix: travis-ci, only update docker on aarch64 * skip test_multiarch_image on s390x / ppc64le * skip flaky test * chore: only install test deps on Travis CI * fix: do not try to pull images tagged `cibw_local` * use "--pull=never" for local images * Use docker image inspect to check if an image needs to be pulled
1 parent fd11286 commit 0787a44

File tree

15 files changed

+299
-119
lines changed

15 files changed

+299
-119
lines changed

.circleci/prepare.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -o xtrace
44

55
if [ "$(uname -s)" == "Darwin" ]; then
66
sudo softwareupdate --install-rosetta --agree-to-license
7+
else
8+
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
79
fi
810

911
$PYTHON --version

.cirrus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ linux_x86_task:
1717
memory: 8G
1818

1919
install_pre_requirements_script:
20+
- docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
2021
- apt install -y python3-venv python-is-python3
2122
<<: *RUN_TESTS
2223

@@ -30,6 +31,7 @@ linux_aarch64_task:
3031
memory: 4G
3132

3233
install_pre_requirements_script:
34+
- docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
3335
- apt install -y python3-venv python-is-python3
3436
<<: *RUN_TESTS
3537

.github/workflows/test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ jobs:
5959
docker system prune -a -f
6060
df -h
6161
62+
# for oci_container unit tests
63+
- name: Set up QEMU
64+
if: runner.os == 'Linux'
65+
uses: docker/setup-qemu-action@v3
66+
6267
- name: Install dependencies
6368
run: |
6469
uv pip install --system ".[test]"
@@ -157,10 +162,7 @@ jobs:
157162
run: python -m pip install ".[test,uv]"
158163

159164
- name: Set up QEMU
160-
id: qemu
161165
uses: docker/setup-qemu-action@v3
162-
with:
163-
platforms: all
164166

165167
- name: Run the emulation tests
166168
run: pytest --run-emulation ${{ matrix.arch }} test/test_emulation.py

.gitlab-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ linux:
1515
PYTEST_ADDOPTS: -k "unit_test or test_0_basic" --suppress-no-test-exit-code
1616
script:
1717
- curl -sSL https://get.docker.com/ | sh
18+
- docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
1819
- python -m pip install -e ".[dev]" pytest-custom-exit-code
1920
- python ./bin/run_tests.py
2021

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ jobs:
2020
group: edge
2121
virt: vm
2222
env: PYTHON=python
23+
# docker is outdated in the arm64-graviton2 vm focal image (19.x)
24+
# we need to upgrade to get >= 24.0
25+
addons:
26+
apt:
27+
sources:
28+
- sourceline: 'deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable'
29+
packages:
30+
- docker-ce docker-ce-cli containerd.io
2331

2432
- name: Linux | ppc64le | Python 3.9
2533
python: 3.9
@@ -48,8 +56,9 @@ jobs:
4856
env: PYTHON=python
4957

5058
install:
59+
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all; fi
5160
- $PYTHON -m pip install -U pip
52-
- $PYTHON -m pip install -e ".[dev]" pytest-custom-exit-code
61+
- $PYTHON -m pip install -e ".[test]" pytest-custom-exit-code
5362

5463
script: |
5564
# travis_wait disable the output while waiting

appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ init:
1717
if (-not ($BRANCH -eq 'main' -or $BRANCH.ToLower().StartsWith('appveyor-'))) {
1818
$env:PYTEST_ADDOPTS = '-k "unit_test or test_0_basic" --suppress-no-test-exit-code'
1919
}
20+
if ($IsLinux) {
21+
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
22+
}
2023
2124
install:
2225
- python -m pip install -U pip

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
inputs:
1414
versionSpec: '3.8'
1515
- bash: |
16+
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all
1617
python -m pip install -e ".[dev]"
1718
python ./bin/run_tests.py
1819

bin/run_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# unit tests
2929
unit_test_args = [sys.executable, "-m", "pytest", "unit_test"]
3030

31-
if sys.platform.startswith("linux"):
31+
if sys.platform.startswith("linux") and os.environ.get("CIBW_PLATFORM", "linux") == "linux":
3232
# run the docker unit tests only on Linux
3333
unit_test_args += ["--run-docker"]
3434

cibuildwheel/architecture.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def parse_config(config: str, platform: PlatformName) -> set[Architecture]:
6464
if arch_str == "auto":
6565
result |= Architecture.auto_archs(platform=platform)
6666
elif arch_str == "native":
67-
result.add(Architecture(platform_module.machine()))
67+
native_arch = Architecture.native_arch(platform=platform)
68+
if native_arch:
69+
result.add(native_arch)
6870
elif arch_str == "all":
6971
result |= Architecture.all_archs(platform=platform)
7072
elif arch_str == "auto64":

cibuildwheel/errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@ def __init__(self, wheel_name: str) -> None:
5858
)
5959
super().__init__(message)
6060
self.return_code = 6
61+
62+
63+
class OCIEngineTooOldError(FatalError):
64+
return_code = 7

0 commit comments

Comments
 (0)