diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-08-22 14:04:58 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-18 13:40:42 +0300 |
commit | 02129c294d4f749d04835d231a24e81850347ebb (patch) | |
tree | 9a56ead95909b47f677c8259d96d89e2c14129af | |
parent | a744279f5ae55a52a04a5e3a719974992656bc70 (diff) | |
download | gitlab-ce-dz-expose-cluster-id-to-jupyter.tar.gz |
Add GitLab cluster id to jupyter configdz-expose-cluster-id-to-jupyter
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/models/clusters/applications/jupyter.rb | 5 | ||||
-rw-r--r-- | spec/models/clusters/applications/jupyter_spec.rb | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/app/models/clusters/applications/jupyter.rb b/app/models/clusters/applications/jupyter.rb index 3d84eeed5a8..7be6a14f585 100644 --- a/app/models/clusters/applications/jupyter.rb +++ b/app/models/clusters/applications/jupyter.rb @@ -73,6 +73,11 @@ module Clusters "clientSecret" => oauth_application.secret, "callbackUrl" => callback_url } + }, + "singleuser" => { + "extraEnv" => { + "GITLAB_CLUSTER_ID" => cluster.id + } } } end diff --git a/spec/models/clusters/applications/jupyter_spec.rb b/spec/models/clusters/applications/jupyter_spec.rb index 591a01d78a9..9c4396731eb 100644 --- a/spec/models/clusters/applications/jupyter_spec.rb +++ b/spec/models/clusters/applications/jupyter_spec.rb @@ -108,8 +108,15 @@ describe Clusters::Applications::Jupyter do expect(values).to include('rbac') expect(values).to include('proxy') expect(values).to include('auth') + expect(values).to include('singleuser') expect(values).to match(/clientId: '?#{application.oauth_application.uid}/) expect(values).to match(/callbackUrl: '?#{application.callback_url}/) end + + context 'when cluster belongs to a project' do + it 'sets GitLab project id' do + expect(values).to match(/GITLAB_CLUSTER_ID: '?#{application.cluster.id}/) + end + end end end |