Skip to content
代码片段 群组 项目
提交 2de5c504 编辑于 作者: Gabriel Mazetto's avatar Gabriel Mazetto
浏览文件

Decouple `ci_secure_files_path` in `SourceContext`

上级 5e02b872
No related branches found
No related tags found
无相关合并请求
...@@ -11,6 +11,7 @@ class SourceContext ...@@ -11,6 +11,7 @@ class SourceContext
# Defaults defined in `config/initializers/1_settings.rb` # Defaults defined in `config/initializers/1_settings.rb`
DEFAULT_CI_BUILDS_PATH = 'builds/' DEFAULT_CI_BUILDS_PATH = 'builds/'
DEFAULT_JOBS_ARTIFACTS_PATH = 'artifacts/' DEFAULT_JOBS_ARTIFACTS_PATH = 'artifacts/'
DEFAULT_SECURE_FILES_PATH = 'ci_secure_files/'
def gitlab_version def gitlab_version
File.read(gitlab_basepath.join("VERSION")).strip.freeze File.read(gitlab_basepath.join("VERSION")).strip.freeze
...@@ -40,8 +41,10 @@ def ci_job_artifacts_path ...@@ -40,8 +41,10 @@ def ci_job_artifacts_path
# CI Secure Files basepath # CI Secure Files basepath
def ci_secure_files_path def ci_secure_files_path
# TODO: Use configuration solver path = gitlab_config.dig(env, 'ci_secure_files', 'storage_path') ||
Settings.ci_secure_files.storage_path gitlab_shared_path.join(DEFAULT_SECURE_FILES_PATH)
absolute_path(path)
end end
# CI LFS basepath # CI LFS basepath
......
...@@ -76,7 +76,7 @@ test: ...@@ -76,7 +76,7 @@ test:
ci_secure_files: ci_secure_files:
enabled: true enabled: true
storage_path: tmp/tests/ci_secure_files storage_path: /tmp/gitlab/full/ci_secure_files
object_store: object_store:
enabled: false enabled: false
remote_directory: ci-secure-files remote_directory: ci-secure-files
......
...@@ -95,6 +95,32 @@ ...@@ -95,6 +95,32 @@
end end
end end
describe '#ci_secure_files_path' do
context 'with a missing configuration value' do
it 'returns the default value in full path' do
use_gitlab_config_fixture('gitlab-missingconfigs.yml')
expect(context.ci_secure_files_path).to eq(fake_gitlab_basepath.join('test-shared/ci_secure_files'))
end
end
context 'with a relative path configured in gitlab.yml' do
it 'returns a full path based on gitlab basepath' do
use_gitlab_config_fixture('gitlab-relativepaths.yml')
expect(context.ci_secure_files_path).to eq(fake_gitlab_basepath.join('tmp/tests/ci_secure_files'))
end
end
context 'with a full path configured in gitlab.yml' do
it 'returns a full path as configured in gitlab.yml' do
use_gitlab_config_fixture('gitlab.yml')
expect(context.ci_secure_files_path).to eq(Pathname('/tmp/gitlab/full/ci_secure_files'))
end
end
end
describe '#gitlab_shared_path' do describe '#gitlab_shared_path' do
context 'with shared path not configured in gitlab.yml' do context 'with shared path not configured in gitlab.yml' do
it 'raises an error' do it 'raises an error' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册