From 13a8722464565b272bc00acd608761a3a83dcce0 Mon Sep 17 00:00:00 2001 From: Amit Rathi Date: Wed, 5 Jun 2019 19:50:29 +0000 Subject: Setup Git client for Jupyter --- vendor/jupyter/values.yaml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'vendor') diff --git a/vendor/jupyter/values.yaml b/vendor/jupyter/values.yaml index a5e13fdc104..0fbf36b39cc 100644 --- a/vendor/jupyter/values.yaml +++ b/vendor/jupyter/values.yaml @@ -4,9 +4,9 @@ rbac: hub: extraEnv: JUPYTER_ENABLE_LAB: 1 - SINGLEUSER_IMAGE: 'registry.gitlab.com/gitlab-org/jupyterhub-user-image:latest' extraConfig: | c.KubeSpawner.cmd = ['jupyter-labhub'] + c.GitLabOAuthenticator.scope = ['api read_repository write_repository'] async def add_auth_env(spawner): ''' @@ -23,6 +23,8 @@ hub: spawner.environment['GITLAB_ACCESS_TOKEN'] = auth_state['access_token'] spawner.environment['GITLAB_USER_LOGIN'] = auth_state['gitlab_user']['username'] spawner.environment['GITLAB_USER_ID'] = str(auth_state['gitlab_user']['id']) + spawner.environment['GITLAB_USER_EMAIL'] = auth_state['gitlab_user']['email'] + spawner.environment['GITLAB_USER_NAME'] = auth_state['gitlab_user']['name'] c.KubeSpawner.pre_spawn_hook = add_auth_env @@ -33,10 +35,22 @@ auth: singleuser: defaultUrl: "/lab" + image: + name: registry.gitlab.com/gitlab-org/jupyterhub-user-image + tag: latest lifecycleHooks: postStart: exec: - command: ["sh", "-c", "git clone https://gitlab.com/gitlab-org/nurtch-demo.git DevOps-Runbook-Demo || true"] + command: + - "sh" + - "-c" + - > + git clone https://gitlab.com/gitlab-org/nurtch-demo.git DevOps-Runbook-Demo || true; + echo "https://${GITLAB_USER_LOGIN}:${GITLAB_ACCESS_TOKEN}@${GITLAB_HOST}" > ~/.git-credentials; + git config --global credential.helper store; + git config --global user.email "${GITLAB_USER_EMAIL}"; + git config --global user.name "${GITLAB_USER_NAME}"; + jupyter serverextension enable --py jupyterlab_git ingress: enabled: true -- cgit v1.2.1