Skip to content

Commit a6b4826

Browse files
committed
BuildExecutor.identifier for BinderHub /version endpoint
1 parent 66cd6f4 commit a6b4826

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

binderhub/app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,9 @@ def initialize(self, *args, **kwargs):
869869

870870
launch_quota = self.launch_quota_class(parent=self, executor=self.executor)
871871

872+
# Construct a Builder so that we can extract the version string to pass to the
873+
# /version handler
874+
temporary_builder = self.build_class(parent=self)
872875
self.tornado_settings.update(
873876
{
874877
"log_function": log_request,
@@ -881,6 +884,7 @@ def initialize(self, *args, **kwargs):
881884
"build_token_check_origin": self.build_token_check_origin,
882885
"build_token_secret": self.build_token_secret,
883886
"build_token_expires_seconds": self.build_token_expires_seconds,
887+
"builder_identifier": temporary_builder.identifier,
884888
"pod_quota": self.pod_quota,
885889
"per_repo_quota": self.per_repo_quota,
886890
"per_repo_quota_higher": self.per_repo_quota_higher,

binderhub/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ async def get(self):
247247
self.write(
248248
json.dumps(
249249
{
250-
"builder": self.settings["build_image"],
250+
"builder": self.settings["builder_identifier"],
251251
"binderhub": binder_version,
252252
}
253253
)

binderhub/build.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ class BuildExecutor(LoggingConfigurable):
101101
config=True,
102102
)
103103

104+
identifier = Unicode(
105+
"",
106+
help=(
107+
"Identifier or other metadata for the builder e.g. repo2docker version. "
108+
"This is included in the BinderHub version endpoint"
109+
),
110+
config=True,
111+
)
112+
104113
def __init__(self, **kwargs):
105114
super().__init__(**kwargs)
106115
self.main_loop = IOLoop.current()
@@ -239,6 +248,10 @@ def _default_namespace(self):
239248
config=True,
240249
)
241250

251+
@default("identifier")
252+
def _default_identifier(self):
253+
return self.build_image
254+
242255
docker_host = Unicode(
243256
"/var/run/docker.sock",
244257
help=(

0 commit comments

Comments
 (0)