Skip to content

Commit e42f040

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

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

binderhub/build.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,16 @@ class BuildExecutor(LoggingConfigurable):
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
)
@@ -247,6 +249,22 @@ def _default_api(self):
247249
config=True,
248250
)
249251

252+
registry_credentials = Unicode(
253+
"",
254+
help=(
255+
"Implementation dependent credentials for pushing image to a registry. "
256+
"For example, if push tokens are temporary this could be used to pass "
257+
"dynamically created credentials as an encoded JSON blob "
258+
'`{"registry": "docker.io", "username":"user", "password":"password"}` '
259+
"in the environment variable `CONTAINER_ENGINE_REGISTRY_CREDENTIALS` to "
260+
"repo2docker. "
261+
"If provided this will be used instead of push_secret. "
262+
"Currently this is passed to the build pod as a plan text environment "
263+
"variable, though future implementations may use a Kubernetes secret."
264+
),
265+
config=True,
266+
)
267+
250268
namespace = Unicode(
251269
help="Kubernetes namespace to spawn build pods into", config=True
252270
)
@@ -415,11 +433,11 @@ def submit(self):
415433
client.V1EnvVar(name="GIT_CREDENTIAL_ENV", value=self.git_credentials)
416434
)
417435

418-
if self.push_secret_content:
436+
if self.registry_credentials:
419437
env.append(
420438
client.V1EnvVar(
421439
name="CONTAINER_ENGINE_REGISTRY_CREDENTIALS",
422-
value=self.push_secret_content,
440+
value=self.registry_credentials,
423441
)
424442
)
425443
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)