diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-27 14:21:38 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2018-09-27 14:21:38 +0000 |
commit | f7e28d265cb088c3a0293f459bd81284ec2a8fa7 (patch) | |
tree | a463f34b04cb7b49f7f8e3c8abfd378c4f28e9fd | |
parent | 3fe6f2ceb8dbe2928f14bfe9bd11555e80e4d612 (diff) | |
parent | 02129c294d4f749d04835d231a24e81850347ebb (diff) | |
download | gitlab-ce-f7e28d265cb088c3a0293f459bd81284ec2a8fa7.tar.gz |
Merge branch 'dz-expose-cluster-id-to-jupyter' into 'master'
Add GitLab cluster id to jupyter config
Closes #51474 and #51594
See merge request gitlab-org/gitlab-ce!21796
-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 |