Skip to content

Commit f381eb3

Browse files
committed
Replace push_secret_content with registry_credentials
1 parent a8d5049 commit f381eb3

File tree

2 files changed

+32
-11
lines changed

2 files changed

+32
-11
lines changed

binderhub/build.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,20 @@ class BuildExecutor(LoggingConfigurable):
8787

8888
push_secret = Unicode(
8989
"",
90-
help="Implementation dependent secret for pushing image to a registry.",
90+
help="Implementation dependent static secret for pushing image to a registry.",
9191
config=True,
9292
)
9393

94-
push_secret_content = Unicode(
94+
registry_credentials = Unicode(
9595
"",
9696
help=(
97-
"Content of an implementation dependent secret for pushing image to a registry. "
98-
"For example, if push tokens are temporary this can be used to pass the token "
99-
"as an environment variable CONTAINER_ENGINE_REGISTRY_CREDENTIALS to "
100-
"repo2docker."
101-
"If provided this will be used instead of push_secret."
97+
"Implementation dependent credentials for pushing image to a registry. "
98+
"For example, if push tokens are temporary this could be used to pass "
99+
"dynamically created credentials as an encoded JSON blob "
100+
'`{"registry": "docker.io", "username":"user", "password":"password"}` '
101+
"in the environment variable `CONTAINER_ENGINE_REGISTRY_CREDENTIALS` to "
102+
"repo2docker. "
103+
"If provided this will be used instead of push_secret. "
102104
),
103105
config=True,
104106
)
@@ -243,7 +245,26 @@ def _default_api(self):
243245
# Overrides the default for BuildExecutor
244246
push_secret = Unicode(
245247
"binder-build-docker-config",
246-
help="Implementation dependent secret for pushing image to a registry.",
248+
help=(
249+
"Name of a Kubernetes secret containing static credentials for pushing "
250+
"an image to a registry."
251+
),
252+
config=True,
253+
)
254+
255+
registry_credentials = Unicode(
256+
"",
257+
help=(
258+
"Implementation dependent credentials for pushing image to a registry. "
259+
"For example, if push tokens are temporary this could be used to pass "
260+
"dynamically created credentials as an encoded JSON blob "
261+
'`{"registry": "docker.io", "username":"user", "password":"password"}` '
262+
"in the environment variable `CONTAINER_ENGINE_REGISTRY_CREDENTIALS` to "
263+
"repo2docker. "
264+
"If provided this will be used instead of push_secret. "
265+
"Currently this is passed to the build pod as a plan text environment "
266+
"variable, though future implementations may use a Kubernetes secret."
267+
),
247268
config=True,
248269
)
249270

@@ -415,11 +436,11 @@ def submit(self):
415436
client.V1EnvVar(name="GIT_CREDENTIAL_ENV", value=self.git_credentials)
416437
)
417438

418-
if self.push_secret_content:
439+
if self.registry_credentials:
419440
env.append(
420441
client.V1EnvVar(
421442
name="CONTAINER_ENGINE_REGISTRY_CREDENTIALS",
422-
value=self.push_secret_content,
443+
value=self.registry_credentials,
423444
)
424445
)
425446
elif self.push_secret:

binderhub/builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ async def get(self, provider_prefix, _unescaped_spec):
463463
image_without_tag, image_tag
464464
)
465465
if push_token:
466-
build.push_secret_content = json.dumps(push_token)
466+
build.registry_credentials = json.dumps(push_token)
467467
else:
468468
build.push_secret = ""
469469

0 commit comments

Comments
 (0)