Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
03438886
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,发现更多精彩内容 >>
提交
03438886
编写于
3月 06, 2018
作者:
S
Shinya Maeda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change column to file_sha256. Add test. Add changelog
上级
a1c612ce
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
13 addition
and
4 deletion
+13
-4
changelogs/unreleased/feature-sm-add-check-sum-to-job-artifacts.yml
.../unreleased/feature-sm-add-check-sum-to-job-artifacts.yml
+5
-0
db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
...igrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
+1
-1
db/schema.rb
db/schema.rb
+1
-1
lib/api/runner.rb
lib/api/runner.rb
+2
-2
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+4
-0
未找到文件。
changelogs/unreleased/feature-sm-add-check-sum-to-job-artifacts.yml
0 → 100644
浏览文件 @
03438886
---
title
:
Store sha256 checksum to job artifacts
merge_request
:
17354
author
:
type
:
performance
db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
浏览文件 @
03438886
...
@@ -2,6 +2,6 @@ class AddChecksumToCiJobArtifacts < ActiveRecord::Migration
...
@@ -2,6 +2,6 @@ class AddChecksumToCiJobArtifacts < ActiveRecord::Migration
DOWNTIME
=
false
DOWNTIME
=
false
def
change
def
change
add_column
:ci_job_artifacts
,
:
checksum
,
:binary
add_column
:ci_job_artifacts
,
:
file_sha256
,
:binary
end
end
end
end
db/schema.rb
浏览文件 @
03438886
...
@@ -346,7 +346,7 @@ ActiveRecord::Schema.define(version: 20180304204842) do
...
@@ -346,7 +346,7 @@ ActiveRecord::Schema.define(version: 20180304204842) do
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
datetime_with_timezone
"expire_at"
t
.
datetime_with_timezone
"expire_at"
t
.
string
"file"
t
.
string
"file"
t
.
binary
"
checksum
"
t
.
binary
"
file_sha256
"
end
end
add_index
"ci_job_artifacts"
,
[
"expire_at"
,
"job_id"
],
name:
"index_ci_job_artifacts_on_expire_at_and_job_id"
,
using: :btree
add_index
"ci_job_artifacts"
,
[
"expire_at"
,
"job_id"
],
name:
"index_ci_job_artifacts_on_expire_at_and_job_id"
,
using: :btree
...
...
lib/api/runner.rb
浏览文件 @
03438886
...
@@ -204,7 +204,7 @@ module API
...
@@ -204,7 +204,7 @@ module API
optional
'file.path'
,
type:
String
,
desc:
%q(path to locally stored body (generated by Workhorse))
optional
'file.path'
,
type:
String
,
desc:
%q(path to locally stored body (generated by Workhorse))
optional
'file.name'
,
type:
String
,
desc:
%q(real filename as send in Content-Disposition (generated by Workhorse))
optional
'file.name'
,
type:
String
,
desc:
%q(real filename as send in Content-Disposition (generated by Workhorse))
optional
'file.type'
,
type:
String
,
desc:
%q(real content type as send in Content-Type (generated by Workhorse))
optional
'file.type'
,
type:
String
,
desc:
%q(real content type as send in Content-Type (generated by Workhorse))
optional
'file.sha256'
,
type:
String
,
desc:
%q(checksum of the file)
optional
'file.sha256'
,
type:
String
,
desc:
%q(
sha256
checksum of the file)
optional
'metadata.path'
,
type:
String
,
desc:
%q(path to locally stored body (generated by Workhorse))
optional
'metadata.path'
,
type:
String
,
desc:
%q(path to locally stored body (generated by Workhorse))
optional
'metadata.name'
,
type:
String
,
desc:
%q(filename (generated by Workhorse))
optional
'metadata.name'
,
type:
String
,
desc:
%q(filename (generated by Workhorse))
end
end
...
@@ -225,7 +225,7 @@ module API
...
@@ -225,7 +225,7 @@ module API
expire_in
=
params
[
'expire_in'
]
||
expire_in
=
params
[
'expire_in'
]
||
Gitlab
::
CurrentSettings
.
current_application_settings
.
default_artifacts_expire_in
Gitlab
::
CurrentSettings
.
current_application_settings
.
default_artifacts_expire_in
job
.
build_job_artifacts_archive
(
project:
job
.
project
,
file_type: :archive
,
file:
artifacts
,
checksum
:
params
[
'file.sha256'
],
expire_in:
expire_in
)
job
.
build_job_artifacts_archive
(
project:
job
.
project
,
file_type: :archive
,
file:
artifacts
,
file_sha256
:
params
[
'file.sha256'
],
expire_in:
expire_in
)
job
.
build_job_artifacts_metadata
(
project:
job
.
project
,
file_type: :metadata
,
file:
metadata
,
expire_in:
expire_in
)
if
metadata
job
.
build_job_artifacts_metadata
(
project:
job
.
project
,
file_type: :metadata
,
file:
metadata
,
expire_in:
expire_in
)
if
metadata
job
.
artifacts_expire_in
=
expire_in
job
.
artifacts_expire_in
=
expire_in
...
...
spec/requests/api/runner_spec.rb
浏览文件 @
03438886
...
@@ -1100,11 +1100,13 @@ describe API::Runner do
...
@@ -1100,11 +1100,13 @@ describe API::Runner do
context
'posts artifacts file and metadata file'
do
context
'posts artifacts file and metadata file'
do
let!
(
:artifacts
)
{
file_upload
}
let!
(
:artifacts
)
{
file_upload
}
let!
(
:artifacts_sha256
)
{
Digest
::
SHA256
.
file
(
artifacts
.
path
).
hexdigest
}
let!
(
:metadata
)
{
file_upload2
}
let!
(
:metadata
)
{
file_upload2
}
let
(
:stored_artifacts_file
)
{
job
.
reload
.
artifacts_file
.
file
}
let
(
:stored_artifacts_file
)
{
job
.
reload
.
artifacts_file
.
file
}
let
(
:stored_metadata_file
)
{
job
.
reload
.
artifacts_metadata
.
file
}
let
(
:stored_metadata_file
)
{
job
.
reload
.
artifacts_metadata
.
file
}
let
(
:stored_artifacts_size
)
{
job
.
reload
.
artifacts_size
}
let
(
:stored_artifacts_size
)
{
job
.
reload
.
artifacts_size
}
let
(
:stored_artifacts_sha256
)
{
job
.
reload
.
job_artifacts_archive
.
file_sha256
}
before
do
before
do
post
(
api
(
"/jobs/
#{
job
.
id
}
/artifacts"
),
post_data
,
headers_with_token
)
post
(
api
(
"/jobs/
#{
job
.
id
}
/artifacts"
),
post_data
,
headers_with_token
)
...
@@ -1114,6 +1116,7 @@ describe API::Runner do
...
@@ -1114,6 +1116,7 @@ describe API::Runner do
let
(
:post_data
)
do
let
(
:post_data
)
do
{
'file.path'
=>
artifacts
.
path
,
{
'file.path'
=>
artifacts
.
path
,
'file.name'
=>
artifacts
.
original_filename
,
'file.name'
=>
artifacts
.
original_filename
,
'file.sha256'
=>
artifacts_sha256
,
'metadata.path'
=>
metadata
.
path
,
'metadata.path'
=>
metadata
.
path
,
'metadata.name'
=>
metadata
.
original_filename
}
'metadata.name'
=>
metadata
.
original_filename
}
end
end
...
@@ -1123,6 +1126,7 @@ describe API::Runner do
...
@@ -1123,6 +1126,7 @@ describe API::Runner do
expect
(
stored_artifacts_file
.
original_filename
).
to
eq
(
artifacts
.
original_filename
)
expect
(
stored_artifacts_file
.
original_filename
).
to
eq
(
artifacts
.
original_filename
)
expect
(
stored_metadata_file
.
original_filename
).
to
eq
(
metadata
.
original_filename
)
expect
(
stored_metadata_file
.
original_filename
).
to
eq
(
metadata
.
original_filename
)
expect
(
stored_artifacts_size
).
to
eq
(
72821
)
expect
(
stored_artifacts_size
).
to
eq
(
72821
)
expect
(
stored_artifacts_sha256
).
to
eq
(
artifacts_sha256
)
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录