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
5f6d8261
Commit
5f6d8261
authored
Jan 27, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CreateArtifactsTraceWorker
parent
002f314f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
21 deletions
+35
-21
app/services/ci/create_artifacts_trace_service.rb
app/services/ci/create_artifacts_trace_service.rb
+16
-0
app/uploaders/job_artifact_uploader.rb
app/uploaders/job_artifact_uploader.rb
+3
-5
app/workers/build_finished_worker.rb
app/workers/build_finished_worker.rb
+1
-0
app/workers/create_artifacts_trace_worker.rb
app/workers/create_artifacts_trace_worker.rb
+8
-0
lib/api/runner.rb
lib/api/runner.rb
+1
-10
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+6
-6
No files found.
app/services/ci/create_artifacts_trace_service.rb
0 → 100644
View file @
5f6d8261
module
Ci
class
CreateArtifactsTraceService
<
BaseService
def
execute
(
job_id
)
Ci
::
Build
.
find_by
(
id:
job_id
).
try
do
|
job
|
return
if
job
.
job_artifacts_trace
job
.
trace
.
read
do
|
stream
|
job
.
create_job_artifacts_trace!
(
project:
job
.
project
,
file_type: :trace
,
file:
stream
.
path
)
if
stream
.
file?
end
end
end
end
end
app/uploaders/job_artifact_uploader.rb
View file @
5f6d8261
...
@@ -14,11 +14,9 @@ class JobArtifactUploader < GitlabUploader
...
@@ -14,11 +14,9 @@ class JobArtifactUploader < GitlabUploader
end
end
def
open
def
open
if
file_storage?
raise
'Only File System is supported'
unless
file_storage?
File
.
open
(
path
,
"rb"
)
File
.
open
(
path
,
"rb"
)
else
raise
'Only File System is supported'
end
end
end
private
private
...
...
app/workers/build_finished_worker.rb
View file @
5f6d8261
...
@@ -7,6 +7,7 @@ class BuildFinishedWorker
...
@@ -7,6 +7,7 @@ class BuildFinishedWorker
def
perform
(
build_id
)
def
perform
(
build_id
)
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
BuildTraceSectionsWorker
.
perform_async
(
build
.
id
)
BuildTraceSectionsWorker
.
perform_async
(
build
.
id
)
CreateArtifactsTraceWorker
.
perform_async
(
build
.
id
)
BuildCoverageWorker
.
new
.
perform
(
build
.
id
)
BuildCoverageWorker
.
new
.
perform
(
build
.
id
)
BuildHooksWorker
.
new
.
perform
(
build
.
id
)
BuildHooksWorker
.
new
.
perform
(
build
.
id
)
end
end
...
...
app/workers/create_artifacts_trace_worker.rb
0 → 100644
View file @
5f6d8261
class
CreateArtifactsTraceWorker
include
ApplicationWorker
include
PipelineQueue
def
perform
(
job_id
)
Ci
::
CreateArtifactsTraceService
.
new
.
execute
(
job_id
)
end
end
lib/api/runner.rb
View file @
5f6d8261
...
@@ -120,16 +120,7 @@ module API
...
@@ -120,16 +120,7 @@ module API
put
'/:id'
do
put
'/:id'
do
job
=
authenticate_job!
job
=
authenticate_job!
if
params
[
:trace
]
job
.
trace
.
set
(
params
[
:trace
])
if
params
[
:trace
]
# Overwrite live-trace by full-trace
job
.
trace
.
set
(
params
[
:trace
])
# Move full-trace to JobArtifactUploader#default_path
job
.
build_job_artifacts_trace
(
project:
job
.
project
,
file_type: :trace
,
file:
UploadedFile
.
new
(
job
.
trace
.
current_path
,
'trace.log'
))
end
Gitlab
::
Metrics
.
add_event
(
:update_build
,
Gitlab
::
Metrics
.
add_event
(
:update_build
,
project:
job
.
project
.
full_path
)
project:
job
.
project
.
full_path
)
...
...
lib/gitlab/ci/trace.rb
View file @
5f6d8261
...
@@ -101,12 +101,6 @@ module Gitlab
...
@@ -101,12 +101,6 @@ module Gitlab
job
.
erase_old_trace!
job
.
erase_old_trace!
end
end
def
current_path
@current_path
||=
paths
.
find
do
|
trace_path
|
File
.
exist?
(
trace_path
)
end
end
private
private
def
ensure_path
def
ensure_path
...
@@ -122,6 +116,12 @@ module Gitlab
...
@@ -122,6 +116,12 @@ module Gitlab
end
end
end
end
def
current_path
@current_path
||=
paths
.
find
do
|
trace_path
|
File
.
exist?
(
trace_path
)
end
end
##
##
# This method doesn't include the latest path, which is JobArtifactUploader#default_path,
# This method doesn't include the latest path, which is JobArtifactUploader#default_path,
# Because, in EE, traces can be moved to ObjectStorage, so checking paths in Filestorage doesn't make sense.
# Because, in EE, traces can be moved to ObjectStorage, so checking paths in Filestorage doesn't make sense.
...
...
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