Skip to content

Commit f139283

Browse files
committed
Fix LocalRepo2dockerBuild to work with latest BuildExecutor
1 parent 7c910d8 commit f139283

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

binderhub/build_local.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from threading import Thread
1212

1313
from tornado.log import app_log
14+
from traitlets import default
1415

1516
from .build import BuildExecutor, ProgressEvent
1617

@@ -111,6 +112,16 @@ class LocalRepo2dockerBuild(BuildExecutor):
111112
WARNING: This is still under development. Breaking changes may be made at any time.
112113
"""
113114

115+
@default("identifier")
116+
def _default_identifier(self):
117+
try:
118+
import repo2docker
119+
120+
return repo2docker.__version__
121+
except ImportError:
122+
self.log.error("repo2docker not installed")
123+
return ""
124+
114125
def submit(self):
115126
"""
116127
Run a build to create the image for the repository.

binderhub/tests/test_main.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,16 @@ async def test_versions_handler(app):
108108
assert r.status_code == 200
109109

110110
data = r.json()
111-
assert data["builder"] == app.build_image
111+
# Version is different for KubernetesExecutor and LocalRepo2dockerBuild
112+
try:
113+
import repo2docker
114+
115+
allowed_versions = [repo2docker.__version__]
116+
except ImportError:
117+
allowed_versions = []
118+
allowed_versions.append(app.build_image)
119+
120+
assert data["builder"] in allowed_versions
112121
assert data["binderhub"].split("+")[0] == binder_version.split("+")[0]
113122

114123

testing/local-binder-local-hub/binderhub_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
c.BinderHub.builder_required = False
2525

2626
c.BinderHub.build_class = LocalRepo2dockerBuild
27-
c.BinderHub.push_secret = None
27+
c.BinderHub.push_secret = ""
2828
c.BinderHub.launch_quota_class = LaunchQuota
2929

3030
c.BinderHub.about_message = "This is a local dev deployment without Kubernetes"

0 commit comments

Comments
 (0)