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
1d983024
Commit
1d983024
authored
Jan 25, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move default_path to legacy_default_path. Switch to the new path for live-trace
parent
0d960fac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
10 deletions
+28
-10
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+28
-10
No files found.
lib/gitlab/ci/trace.rb
View file @
1d983024
##
# Current status of paths
# Era 1: Live/Full traces in database (ci_builds.trace)
# Era 2: Live/Full traces in `setting_root/YYYY_MM/project_ci_id/job_id.log`
# Era 3: Live/Full traces in `setting_root/YYYY_MM/project_id/job_id.log`
# Era 4: Live traces in `setting_root/live_trace/job_id.log`. Full traces in JobArtifactUploader#legacy_default_path.
#
# The legacy paths are to be migrated to the latest era.
module
Gitlab
module
Gitlab
module
Ci
module
Ci
class
Trace
class
Trace
...
@@ -99,12 +107,12 @@ module Gitlab
...
@@ -99,12 +107,12 @@ module Gitlab
return
current_path
if
current_path
return
current_path
if
current_path
ensure_directory
ensure_directory
default_path
live_trace_
default_path
end
end
def
ensure_directory
def
ensure_directory
unless
Dir
.
exist?
(
default_directory
)
unless
Dir
.
exist?
(
live_trace_
default_directory
)
FileUtils
.
mkdir_p
(
default_directory
)
FileUtils
.
mkdir_p
(
live_trace_
default_directory
)
end
end
end
end
...
@@ -115,24 +123,34 @@ module Gitlab
...
@@ -115,24 +123,34 @@ module Gitlab
end
end
##
##
# This doesn't include the latest path 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.
# All legacy paths (`legacy_default_path` and `deprecated_path`) are to be migrated to JobArtifactUploader#default_path
def
paths
def
paths
[
[
default_path
,
live_trace_default_path
,
legacy_default_path
,
deprecated_path
deprecated_path
].
compact
].
compact
end
end
def
default_directory
def
live_trace_
default_directory
File
.
join
(
File
.
join
(
Settings
.
gitlab_ci
.
builds_path
,
Settings
.
gitlab_ci
.
builds_path
,
job
.
created_at
.
utc
.
strftime
(
"%Y_%m"
),
'live_trace'
job
.
project_id
.
to_s
)
)
end
end
def
default_path
def
live_trace_default_path
File
.
join
(
default_directory
,
"
#{
job
.
id
}
.log"
)
File
.
join
(
live_trace_default_directory
,
"
#{
job
.
id
}
.log"
)
end
def
legacy_default_path
File
.
join
(
Settings
.
gitlab_ci
.
builds_path
,
job
.
created_at
.
utc
.
strftime
(
"%Y_%m"
),
job
.
project_id
.
to_s
,
"
#{
job
.
id
}
.log"
)
end
end
def
deprecated_path
def
deprecated_path
...
...
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