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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
61c8093b
Commit
61c8093b
authored
Apr 03, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store metadata checksum for artifacts
parent
4a9d9f15
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
lib/api/runner.rb
lib/api/runner.rb
+2
-1
spec/requests/api/runner_spec.rb
spec/requests/api/runner_spec.rb
+5
-1
No files found.
lib/api/runner.rb
View file @
61c8093b
...
...
@@ -208,6 +208,7 @@ module API
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))
optional
'metadata.sha256'
,
type:
String
,
desc:
%q(sha256 checksum of the file)
end
post
'/:id/artifacts'
do
not_allowed!
unless
Gitlab
.
config
.
artifacts
.
enabled
...
...
@@ -227,7 +228,7 @@ module API
Gitlab
::
CurrentSettings
.
current_application_settings
.
default_artifacts_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
,
file_sha256:
params
[
'metadata.sha256'
],
expire_in:
expire_in
)
if
metadata
job
.
artifacts_expire_in
=
expire_in
if
job
.
save
...
...
spec/requests/api/runner_spec.rb
View file @
61c8093b
...
...
@@ -1159,11 +1159,13 @@ describe API::Runner do
let!
(
:artifacts
)
{
file_upload
}
let!
(
:artifacts_sha256
)
{
Digest
::
SHA256
.
file
(
artifacts
.
path
).
hexdigest
}
let!
(
:metadata
)
{
file_upload2
}
let!
(
:metadata_sha256
)
{
Digest
::
SHA256
.
file
(
metadata
.
path
).
hexdigest
}
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
}
let
(
:stored_metadata_sha256
)
{
job
.
reload
.
job_artifacts_metadata
.
file_sha256
}
before
do
post
(
api
(
"/jobs/
#{
job
.
id
}
/artifacts"
),
post_data
,
headers_with_token
)
...
...
@@ -1175,7 +1177,8 @@ describe API::Runner do
'file.name'
=>
artifacts
.
original_filename
,
'file.sha256'
=>
artifacts_sha256
,
'metadata.path'
=>
metadata
.
path
,
'metadata.name'
=>
metadata
.
original_filename
}
'metadata.name'
=>
metadata
.
original_filename
,
'metadata.sha256'
=>
metadata_sha256
}
end
it
'stores artifacts and artifacts metadata'
do
...
...
@@ -1184,6 +1187,7 @@ describe API::Runner do
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
)
expect
(
stored_metadata_sha256
).
to
eq
(
metadata_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