Commit aa15c9fe authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add cluster project id to jupyter config

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent f3d9e19b
...@@ -72,10 +72,19 @@ module Clusters ...@@ -72,10 +72,19 @@ module Clusters
"clientSecret" => oauth_application.secret, "clientSecret" => oauth_application.secret,
"callbackUrl" => callback_url "callbackUrl" => callback_url
} }
},
"singleuser" => {
"extraEnv" => {
"GITLAB_PROJECT_ID" => project_id
}
} }
} }
end end
def project_id
cluster&.project&.id
end
def gitlab_url def gitlab_url
Gitlab.config.gitlab.url Gitlab.config.gitlab.url
end end
......
...@@ -99,8 +99,21 @@ describe Clusters::Applications::Jupyter do ...@@ -99,8 +99,21 @@ describe Clusters::Applications::Jupyter do
expect(values).to include('rbac') expect(values).to include('rbac')
expect(values).to include('proxy') expect(values).to include('proxy')
expect(values).to include('auth') expect(values).to include('auth')
expect(values).to include('singleuser')
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}/)
end end
context 'when cluster belongs to a project' do
let(:project) { create(:project) }
before do
application.cluster.projects << project
end
it 'sets GitLab project id' do
expect(values).to match(/GITLAB_PROJECT_ID: '?#{project.id}/)
end
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment