Skip to content

Commit 8d1c0e7

Browse files
authored
Merge pull request #1319 from g-braeunlich/target-repo-dir
Make build class configurable
2 parents ab12fc6 + 84d2288 commit 8d1c0e7

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

binderhub/app.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
TraitError,
3232
Unicode,
3333
Union,
34+
Type,
3435
default,
3536
observe,
3637
validate,
@@ -249,6 +250,16 @@ def _valid_badge_base_url(self, proposal):
249250
config=True
250251
)
251252

253+
build_class = Type(
254+
Build,
255+
help="""
256+
The class used to build repo2docker images.
257+
258+
Must inherit from binderhub.build.Build
259+
""",
260+
config=True
261+
)
262+
252263
per_repo_quota = Integer(
253264
0,
254265
help="""
@@ -751,6 +762,7 @@ def initialize(self, *args, **kwargs):
751762
"repo_providers": self.repo_providers,
752763
"rate_limiter": RateLimiter(parent=self),
753764
"use_registry": self.use_registry,
765+
"build_class": self.build_class,
754766
"registry": registry,
755767
"traitlets_config": self.config,
756768
"google_analytics_code": self.google_analytics_code,

binderhub/builder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from prometheus_client import Counter, Histogram, Gauge
2323

2424
from .base import BaseHandler
25-
from .build import Build, FakeBuild
2625
from .utils import KUBE_REQUEST_TIMEOUT
2726

2827
# Separate buckets for builds and launches.
@@ -393,7 +392,7 @@ async def get(self, provider_prefix, _unescaped_spec):
393392
else:
394393
push_secret = None
395394

396-
BuildClass = FakeBuild if self.settings.get('fake_build') else Build
395+
BuildClass = self.settings.get('build_class')
397396

398397
appendix = self.settings['appendix'].format(
399398
binder_url=self.binder_launch_host + self.binder_request,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
# - JupyterHub: mocked
88

99
from binderhub.repoproviders import FakeProvider
10+
from binderhub.build import FakeBuild
1011

1112
c.BinderHub.debug = True
1213
c.BinderHub.use_registry = False
1314
c.BinderHub.builder_required = False
1415
c.BinderHub.repo_providers = {'gh': FakeProvider}
15-
c.BinderHub.tornado_settings.update({'fake_build': True})
16+
c.BinderHub.build_class = FakeBuild
1617

1718
c.BinderHub.about_message = "<blink>Hello world.</blink>"
1819
c.BinderHub.banner_message = 'This is headline <a href="#">news.</a>'

0 commit comments

Comments
 (0)