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

Decouple `pages_path` in `SourceContext`

上级 e8825117
No related branches found
No related tags found
无相关合并请求
...@@ -14,6 +14,7 @@ class SourceContext ...@@ -14,6 +14,7 @@ class SourceContext
DEFAULT_SECURE_FILES_PATH = 'ci_secure_files/' DEFAULT_SECURE_FILES_PATH = 'ci_secure_files/'
DEFAULT_CI_LFS_PATH = 'lfs-objects/' DEFAULT_CI_LFS_PATH = 'lfs-objects/'
DEFAULT_PACKAGES = 'packages/' DEFAULT_PACKAGES = 'packages/'
DEFAULT_PAGES = 'pages/'
def gitlab_version def gitlab_version
File.read(gitlab_basepath.join("VERSION")).strip.freeze File.read(gitlab_basepath.join("VERSION")).strip.freeze
...@@ -67,8 +68,10 @@ def packages_path ...@@ -67,8 +68,10 @@ def packages_path
# GitLab Pages basepath # GitLab Pages basepath
def pages_path def pages_path
# TODO: Use configuration solver path = gitlab_config.dig(env, 'pages', 'path') ||
Gitlab.config.pages.path gitlab_shared_path.join(DEFAULT_PAGES)
absolute_path(path)
end end
# Registry basepath # Registry basepath
......
...@@ -119,7 +119,7 @@ test: ...@@ -119,7 +119,7 @@ test:
# your system username you use to run GitLab # your system username you use to run GitLab
# user: YOUR_USERNAME # user: YOUR_USERNAME
pages: pages:
path: tmp/tests/pages path: /tmp/gitlab/full/pages
object_store: object_store:
enabled: false enabled: false
remote_directory: pages # The bucket name remote_directory: pages # The bucket name
...@@ -130,7 +130,7 @@ test: ...@@ -130,7 +130,7 @@ test:
region: us-east-1 region: us-east-1
local_store: local_store:
enabled: true enabled: true
path: tmp/tests/pages path: /tmp/gitlab/full/pages
repositories: repositories:
storages: storages:
default: default:
......
...@@ -173,6 +173,32 @@ ...@@ -173,6 +173,32 @@
end end
end end
describe '#pages_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.pages_path).to eq(fake_gitlab_basepath.join('test-shared/pages'))
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.pages_path).to eq(fake_gitlab_basepath.join('tmp/tests/pages'))
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.pages_path).to eq(Pathname('/tmp/gitlab/full/pages'))
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.
先完成此消息的编辑!
想要评论请 注册