Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
03438886
Commit
03438886
authored
Mar 06, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change column to file_sha256. Add test. Add changelog
parent
a1c612ce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
4 deletions
+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
No files found.
changelogs/unreleased/feature-sm-add-check-sum-to-job-artifacts.yml
0 → 100644
View file @
03438886
---
title
:
Store sha256 checksum to job artifacts
merge_request
:
17354
author
:
type
:
performance
db/migrate/20180226050030_add_checksum_to_ci_job_artifacts.rb
View file @
03438886
...
...
@@ -2,6 +2,6 @@ class AddChecksumToCiJobArtifacts < ActiveRecord::Migration
DOWNTIME
=
false
def
change
add_column
:ci_job_artifacts
,
:
checksum
,
:binary
add_column
:ci_job_artifacts
,
:
file_sha256
,
:binary
end
end
db/schema.rb
View file @
03438886
...
...
@@ -346,7 +346,7 @@ ActiveRecord::Schema.define(version: 20180304204842) do
t
.
datetime_with_timezone
"updated_at"
,
null:
false
t
.
datetime_with_timezone
"expire_at"
t
.
string
"file"
t
.
binary
"
checksum
"
t
.
binary
"
file_sha256
"
end
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
View file @
03438886
...
...
@@ -204,7 +204,7 @@ module API
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.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.name'
,
type:
String
,
desc:
%q(filename (generated by Workhorse))
end
...
...
@@ -225,7 +225,7 @@ module API
expire_in
=
params
[
'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
.
artifacts_expire_in
=
expire_in
...
...
spec/requests/api/runner_spec.rb
View file @
03438886
...
...
@@ -1100,11 +1100,13 @@ describe API::Runner do
context
'posts artifacts file and metadata file'
do
let!
(
:artifacts
)
{
file_upload
}
let!
(
:artifacts_sha256
)
{
Digest
::
SHA256
.
file
(
artifacts
.
path
).
hexdigest
}
let!
(
:metadata
)
{
file_upload2
}
let
(
:stored_artifacts_file
)
{
job
.
reload
.
artifacts_file
.
file
}
let
(
:stored_metadata_file
)
{
job
.
reload
.
artifacts_metadata
.
file
}
let
(
:stored_artifacts_size
)
{
job
.
reload
.
artifacts_size
}
let
(
:stored_artifacts_sha256
)
{
job
.
reload
.
job_artifacts_archive
.
file_sha256
}
before
do
post
(
api
(
"/jobs/
#{
job
.
id
}
/artifacts"
),
post_data
,
headers_with_token
)
...
...
@@ -1114,6 +1116,7 @@ describe API::Runner do
let
(
:post_data
)
do
{
'file.path'
=>
artifacts
.
path
,
'file.name'
=>
artifacts
.
original_filename
,
'file.sha256'
=>
artifacts_sha256
,
'metadata.path'
=>
metadata
.
path
,
'metadata.name'
=>
metadata
.
original_filename
}
end
...
...
@@ -1123,6 +1126,7 @@ describe API::Runner do
expect
(
stored_artifacts_file
.
original_filename
).
to
eq
(
artifacts
.
original_filename
)
expect
(
stored_metadata_file
.
original_filename
).
to
eq
(
metadata
.
original_filename
)
expect
(
stored_artifacts_size
).
to
eq
(
72821
)
expect
(
stored_artifacts_sha256
).
to
eq
(
artifacts_sha256
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment