Skip to content

Commit 0a652f5

Browse files
committed
Handle breaking changes in repo2docker
jupyterhub/repo2docker#1421
1 parent 9e350ce commit 0a652f5

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
python_version: ["3.9"]
2222
container_engine:
2323
- podman
24+
repo2docker_version:
25+
# Use version in dev-requirements.txt
26+
- ""
2427
repo_type:
2528
# Only test a subset of the repo2docker tests since we're testing podman,
2629
# not the full repo2docker functionality
@@ -48,6 +51,10 @@ jobs:
4851
- python_version: "3.11"
4952
container_engine: nerdctl
5053
repo_type: venv/default
54+
- python_version: "3.13"
55+
container_engine: podman
56+
repo_type: base
57+
repo2docker_version: e795060aec3555a6203ed79c3676765fb3f3b850
5158

5259
steps:
5360
- name: Checkout repo
@@ -69,9 +76,16 @@ jobs:
6976
containerd-rootless-setuptool.sh install
7077
containerd-rootless-setuptool.sh install-buildkit
7178
72-
- name: Install
79+
- name: Install dependencies
7380
run: |
7481
pip install -r dev-requirements.txt
82+
if [ -n "${{ matrix.repo2docker_version }}" ]; then
83+
pip install git+https://github.com/jupyterhub/repo2docker@${{ matrix.repo2docker_version }}
84+
fi
85+
pip freeze
86+
87+
- name: Install
88+
run: |
7589
# Make a wheel and install it to catch possible issues with releases
7690
python -m build --wheel
7791
pip install dist/*.whl

repo2podman/podman.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ def __init__(self, *, parent):
381381
def build(
382382
self,
383383
*,
384+
push=False,
385+
load=False,
384386
buildargs=None,
385387
cache_from=None,
386388
container_limits=None,
@@ -449,6 +451,11 @@ def build(
449451
# except KeyError:
450452
# pass
451453

454+
# load is ignored, only used by docker buildx
455+
# https://github.com/jupyterhub/repo2docker/pull/1421/files
456+
if push and not tag:
457+
raise ValueError("tag required when push=True")
458+
452459
if kwargs:
453460
raise ValueError("Additional kwargs not supported")
454461

@@ -474,6 +481,10 @@ def build(
474481
):
475482
yield line
476483

484+
if push:
485+
for line in self.push(tag):
486+
yield line
487+
477488
def images(self):
478489
def remove_local(tags):
479490
if tags:
@@ -503,6 +514,18 @@ def remove_local(tags):
503514
]
504515

505516
def inspect_image(self, image):
517+
# https://github.com/jupyterhub/repo2docker/pull/1421
518+
# Return None if image doesn't exist
519+
try:
520+
exec_podman(
521+
["image", "exists", image], capture="both", exe=self.podman_executable
522+
)
523+
except PodmanCommandError as e:
524+
if isinstance(e.e, CalledProcessError):
525+
if e.e.returncode == 1:
526+
return None
527+
raise
528+
506529
lines = exec_podman(
507530
["inspect", "--type", "image", "--format", self.format_arg, image],
508531
capture="stdout",

0 commit comments

Comments
 (0)