Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
13a87224
Commit
13a87224
authored
Jun 05, 2019
by
Amit Rathi
Committed by
Dmitriy Zaporozhets
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setup Git client for Jupyter
parent
93d4353b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
4 deletions
+34
-4
app/models/clusters/applications/jupyter.rb
app/models/clusters/applications/jupyter.rb
+10
-1
app/services/clusters/applications/base_service.rb
app/services/clusters/applications/base_service.rb
+1
-1
changelogs/unreleased/t1.yml
changelogs/unreleased/t1.yml
+5
-0
spec/models/clusters/applications/jupyter_spec.rb
spec/models/clusters/applications/jupyter_spec.rb
+2
-0
vendor/jupyter/values.yaml
vendor/jupyter/values.yaml
+16
-2
No files found.
app/models/clusters/applications/jupyter.rb
View file @
13a87224
...
@@ -61,6 +61,10 @@ module Clusters
...
@@ -61,6 +61,10 @@ module Clusters
"http://
#{
hostname
}
/hub/oauth_callback"
"http://
#{
hostname
}
/hub/oauth_callback"
end
end
def
oauth_scopes
'api read_repository write_repository'
end
private
private
def
specification
def
specification
...
@@ -94,7 +98,8 @@ module Clusters
...
@@ -94,7 +98,8 @@ module Clusters
},
},
"singleuser"
=>
{
"singleuser"
=>
{
"extraEnv"
=>
{
"extraEnv"
=>
{
"GITLAB_CLUSTER_ID"
=>
cluster
.
id
.
to_s
"GITLAB_CLUSTER_ID"
=>
cluster
.
id
.
to_s
,
"GITLAB_HOST"
=>
gitlab_host
}
}
}
}
}
}
...
@@ -112,6 +117,10 @@ module Clusters
...
@@ -112,6 +117,10 @@ module Clusters
Gitlab
.
config
.
gitlab
.
url
Gitlab
.
config
.
gitlab
.
url
end
end
def
gitlab_host
Gitlab
.
config
.
gitlab
.
host
end
def
content_values
def
content_values
YAML
.
load_file
(
chart_values_file
).
deep_merge!
(
specification
)
YAML
.
load_file
(
chart_values_file
).
deep_merge!
(
specification
)
end
end
...
...
app/services/clusters/applications/base_service.rb
View file @
13a87224
...
@@ -81,7 +81,7 @@ module Clusters
...
@@ -81,7 +81,7 @@ module Clusters
oauth_application_params
=
{
oauth_application_params
=
{
name:
params
[
:application
],
name:
params
[
:application
],
redirect_uri:
application
.
callback_url
,
redirect_uri:
application
.
callback_url
,
scopes:
'api read_user openid'
,
scopes:
application
.
oauth_scopes
,
owner:
current_user
owner:
current_user
}
}
...
...
changelogs/unreleased/t1.yml
0 → 100644
View file @
13a87224
---
title
:
Set up git client in Jupyter installtion
merge_request
:
28783
author
:
Amit Rathi
type
:
added
spec/models/clusters/applications/jupyter_spec.rb
View file @
13a87224
...
@@ -96,6 +96,8 @@ describe Clusters::Applications::Jupyter do
...
@@ -96,6 +96,8 @@ describe Clusters::Applications::Jupyter do
expect
(
values
).
to
match
(
/clientId: '?
#{
application
.
oauth_application
.
uid
}
/
)
expect
(
values
).
to
match
(
/clientId: '?
#{
application
.
oauth_application
.
uid
}
/
)
expect
(
values
).
to
match
(
/callbackUrl: '?
#{
application
.
callback_url
}
/
)
expect
(
values
).
to
match
(
/callbackUrl: '?
#{
application
.
callback_url
}
/
)
expect
(
values
).
to
include
(
"gitlabProjectIdWhitelist:
\n
-
#{
application
.
cluster
.
project
.
id
}
"
)
expect
(
values
).
to
include
(
"gitlabProjectIdWhitelist:
\n
-
#{
application
.
cluster
.
project
.
id
}
"
)
expect
(
values
).
to
include
(
"c.GitLabOAuthenticator.scope = ['api read_repository write_repository']"
)
expect
(
values
).
to
match
(
/GITLAB_HOST: '?
#{
Gitlab
.
config
.
gitlab
.
host
}
/
)
end
end
context
'when cluster belongs to a project'
do
context
'when cluster belongs to a project'
do
...
...
vendor/jupyter/values.yaml
View file @
13a87224
...
@@ -4,9 +4,9 @@ rbac:
...
@@ -4,9 +4,9 @@ rbac:
hub
:
hub
:
extraEnv
:
extraEnv
:
JUPYTER_ENABLE_LAB
:
1
JUPYTER_ENABLE_LAB
:
1
SINGLEUSER_IMAGE
:
'
registry.gitlab.com/gitlab-org/jupyterhub-user-image:latest'
extraConfig
:
|
extraConfig
:
|
c.KubeSpawner.cmd = ['jupyter-labhub']
c.KubeSpawner.cmd = ['jupyter-labhub']
c.GitLabOAuthenticator.scope = ['api read_repository write_repository']
async def add_auth_env(spawner):
async def add_auth_env(spawner):
'''
'''
...
@@ -23,6 +23,8 @@ hub:
...
@@ -23,6 +23,8 @@ hub:
spawner.environment['GITLAB_ACCESS_TOKEN'] = auth_state['access_token']
spawner.environment['GITLAB_ACCESS_TOKEN'] = auth_state['access_token']
spawner.environment['GITLAB_USER_LOGIN'] = auth_state['gitlab_user']['username']
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_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
c.KubeSpawner.pre_spawn_hook = add_auth_env
...
@@ -33,10 +35,22 @@ auth:
...
@@ -33,10 +35,22 @@ auth:
singleuser
:
singleuser
:
defaultUrl
:
"
/lab"
defaultUrl
:
"
/lab"
image
:
name
:
registry.gitlab.com/gitlab-org/jupyterhub-user-image
tag
:
latest
lifecycleHooks
:
lifecycleHooks
:
postStart
:
postStart
:
exec
:
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
:
ingress
:
enabled
:
true
enabled
:
true
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment