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
ded38d5f
Commit
ded38d5f
authored
May 31, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add exclusive relase for trace arhive
parent
ad12c58f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
14 deletions
+30
-14
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+30
-14
No files found.
lib/gitlab/ci/trace.rb
View file @
ded38d5f
module
Gitlab
module
Gitlab
module
Ci
module
Ci
class
Trace
class
Trace
include
ExclusiveLeaseGuard
LEASE_TIMEOUT
=
1
.
hour
ArchiveError
=
Class
.
new
(
StandardError
)
ArchiveError
=
Class
.
new
(
StandardError
)
attr_reader
:job
attr_reader
:job
...
@@ -108,20 +112,22 @@ module Gitlab
...
@@ -108,20 +112,22 @@ module Gitlab
raise
ArchiveError
,
'Already archived'
if
trace_artifact
raise
ArchiveError
,
'Already archived'
if
trace_artifact
raise
ArchiveError
,
'Job is not finished yet'
unless
job
.
complete?
raise
ArchiveError
,
'Job is not finished yet'
unless
job
.
complete?
if
job
.
trace_chunks
.
any?
try_obtain_lease
do
Gitlab
::
Ci
::
Trace
::
ChunkedIO
.
new
(
job
)
do
|
stream
|
if
job
.
trace_chunks
.
any?
archive_stream!
(
stream
)
Gitlab
::
Ci
::
Trace
::
ChunkedIO
.
new
(
job
)
do
|
stream
|
stream
.
destroy!
archive_stream!
(
stream
)
end
stream
.
destroy!
elsif
current_path
end
File
.
open
(
current_path
)
do
|
stream
|
elsif
current_path
archive_stream!
(
stream
)
File
.
open
(
current_path
)
do
|
stream
|
FileUtils
.
rm
(
current_path
)
archive_stream!
(
stream
)
end
FileUtils
.
rm
(
current_path
)
elsif
old_trace
end
StringIO
.
new
(
old_trace
,
'rb'
).
tap
do
|
stream
|
elsif
old_trace
archive_stream!
(
stream
)
StringIO
.
new
(
old_trace
,
'rb'
).
tap
do
|
stream
|
job
.
erase_old_trace!
archive_stream!
(
stream
)
job
.
erase_old_trace!
end
end
end
end
end
end
end
...
@@ -206,6 +212,16 @@ module Gitlab
...
@@ -206,6 +212,16 @@ module Gitlab
def
trace_artifact
def
trace_artifact
job
.
job_artifacts_trace
job
.
job_artifacts_trace
end
end
# For ExclusiveLeaseGuard concerns
def
lease_key
@lease_key
||=
self
.
class
.
name
.
underscore
+
":archive:
#{
job
.
id
}
"
end
# For ExclusiveLeaseGuard concern
def
lease_timeout
LEASE_TIMEOUT
end
end
end
end
end
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