Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ba5697fd
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ba5697fd
编写于
11月 08, 2017
作者:
Z
Zeger-Jan van de Weg
提交者:
Kamil Trzcinski
12月 03, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix legacy migration test
上级
1756604f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
38 addition
and
14 deletion
+38
-14
app/uploaders/artifact_uploader.rb
app/uploaders/artifact_uploader.rb
+1
-3
db/migrate/20170918072948_create_job_artifacts.rb
db/migrate/20170918072948_create_job_artifacts.rb
+2
-2
spec/migrations/migrate_old_artifacts_spec.rb
spec/migrations/migrate_old_artifacts_spec.rb
+29
-8
spec/support/test_env.rb
spec/support/test_env.rb
+5
-0
spec/uploaders/artifact_uploader_spec.rb
spec/uploaders/artifact_uploader_spec.rb
+1
-1
未找到文件。
app/uploaders/artifact_uploader.rb
浏览文件 @
ba5697fd
...
...
@@ -34,8 +34,6 @@ class ArtifactUploader < GitlabUploader
end
def
default_path
File
.
join
(
job
.
project_id
.
to_s
,
job
.
created_at
.
utc
.
strftime
(
'%Y_%m'
),
job
.
id
.
to_s
)
File
.
join
(
job
.
created_at
.
utc
.
strftime
(
'%Y_%m'
),
job
.
project_id
.
to_s
,
job
.
id
.
to_s
)
end
end
db/migrate/20170918072948_create_job_artifacts.rb
浏览文件 @
ba5697fd
...
...
@@ -14,8 +14,8 @@ class CreateJobArtifacts < ActiveRecord::Migration
t
.
datetime_with_timezone
:updated_at
,
null:
false
t
.
string
:file
end
add_foreign_key
:ci_job_artifacts
,
:ci_builds
,
column: :job_id
,
on_delete: :cascade
t
.
foreign_key
:ci_builds
,
column: :job_id
,
on_delete: :cascade
end
end
end
spec/migrations/migrate_old_artifacts_spec.rb
浏览文件 @
ba5697fd
...
...
@@ -16,20 +16,22 @@ describe MigrateOldArtifacts do
end
context
'with migratable data'
do
l
et
(
:project1
)
{
create
(
:project
,
ci_id:
2
)
}
l
et
(
:project2
)
{
create
(
:project
,
ci_id:
3
)
}
l
et
(
:project3
)
{
create
(
:project
)
}
s
et
(
:project1
)
{
create
(
:project
,
ci_id:
2
)
}
s
et
(
:project2
)
{
create
(
:project
,
ci_id:
3
)
}
s
et
(
:project3
)
{
create
(
:project
)
}
l
et
(
:pipeline1
)
{
create
(
:ci_empty_pipeline
,
project:
project1
)
}
l
et
(
:pipeline2
)
{
create
(
:ci_empty_pipeline
,
project:
project2
)
}
l
et
(
:pipeline3
)
{
create
(
:ci_empty_pipeline
,
project:
project3
)
}
s
et
(
:pipeline1
)
{
create
(
:ci_empty_pipeline
,
project:
project1
)
}
s
et
(
:pipeline2
)
{
create
(
:ci_empty_pipeline
,
project:
project2
)
}
s
et
(
:pipeline3
)
{
create
(
:ci_empty_pipeline
,
project:
project3
)
}
let!
(
:build_with_legacy_artifacts
)
{
create
(
:ci_build
,
pipeline:
pipeline1
)
}
let!
(
:build_without_artifacts
)
{
create
(
:ci_build
,
pipeline:
pipeline1
)
}
let!
(
:build2
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline2
)
}
let!
(
:build3
)
{
create
(
:ci_build
,
:artifacts
,
pipeline:
pipeline3
)
}
let!
(
:build2
)
{
create
(
:ci_build
,
pipeline:
pipeline2
)
}
let!
(
:build3
)
{
create
(
:ci_build
,
pipeline:
pipeline3
)
}
before
do
setup_builds
(
build2
,
build3
)
store_artifacts_in_legacy_path
(
build_with_legacy_artifacts
)
end
...
...
@@ -113,5 +115,24 @@ describe MigrateOldArtifacts do
build
.
project
.
ci_id
.
to_s
,
build
.
id
.
to_s
)
end
def
new_legacy_path
(
build
)
File
.
join
(
directory
,
build
.
created_at
.
utc
.
strftime
(
'%Y_%m'
),
build
.
project_id
.
to_s
,
build
.
id
.
to_s
)
end
def
setup_builds
(
*
builds
)
builds
.
each
do
|
build
|
FileUtils
.
mkdir_p
(
new_legacy_path
(
build
))
build
.
update_columns
(
artifacts_file:
'ci_build_artifacts.zip'
,
artifacts_metadata:
'ci_build_artifacts_metadata.gz'
)
build
.
reload
end
end
end
end
spec/support/test_env.rb
浏览文件 @
ba5697fd
...
...
@@ -120,6 +120,7 @@ module TestEnv
FileUtils
.
mkdir_p
(
repos_path
)
FileUtils
.
mkdir_p
(
backup_path
)
FileUtils
.
mkdir_p
(
pages_path
)
FileUtils
.
mkdir_p
(
artifacts_path
)
end
def
clean_gitlab_test_path
...
...
@@ -233,6 +234,10 @@ module TestEnv
Gitlab
.
config
.
pages
.
path
end
def
artifacts_path
Gitlab
.
config
.
artifacts
.
path
end
# When no cached assets exist, manually hit the root path to create them
#
# Otherwise they'd be created by the first test, often timing out and
...
...
spec/uploaders/artifact_uploader_spec.rb
浏览文件 @
ba5697fd
...
...
@@ -26,7 +26,7 @@ describe ArtifactUploader do
subject
{
uploader
.
store_dir
}
it
{
is_expected
.
to
start_with
(
path
)
}
it
{
is_expected
.
to
end_with
(
"
#{
job
.
project_id
}
/
#{
job
.
created_at
.
utc
.
strftime
(
'%Y_%m'
)
}
/
#{
job
.
id
}
"
)
}
it
{
is_expected
.
to
end_with
(
"
#{
job
.
project_id
}
/
#{
job
.
id
}
"
)
}
end
describe
'#cache_dir'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录