BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
333d3d9e
Commit
333d3d9e
authored
Dec 30, 2015
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/missing-ci-build-traces' into 'master'
Hotfix for builds trace data integrity Closes #4246 See merge request !2224
parents
e70ffdbf
50469645
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
9 deletions
+57
-9
build.rb
app/models/ci/build.rb
+55
-3
artifact_uploader.rb
app/uploaders/artifact_uploader.rb
+2
-6
No files found.
app/models/ci/build.rb
View file @
333d3d9e
...
...
@@ -194,8 +194,11 @@ module Ci
end
def
raw_trace
if
File
.
exist
?
(
path_to_trace
)
if
File
.
file
?
(
path_to_trace
)
File
.
read
(
path_to_trace
)
elsif
project
.
ci_id
&&
File
.
file?
(
old_path_to_trace
)
# Temporary fix for build trace data integrity
File
.
read
(
old_path_to_trace
)
else
# backward compatibility
read_attribute
:trace
...
...
@@ -212,8 +215,8 @@ module Ci
end
def
trace
=
(
trace
)
unless
Dir
.
exists?
dir_to_trace
FileUtils
.
mkdir_p
dir_to_trace
unless
Dir
.
exists?
(
dir_to_trace
)
FileUtils
.
mkdir_p
(
dir_to_trace
)
end
File
.
write
(
path_to_trace
,
trace
)
...
...
@@ -231,6 +234,55 @@ module Ci
"
#{
dir_to_trace
}
/
#{
id
}
.log"
end
##
# Deprecated
#
# This is a hotfix for CI build data integrity, see #4246
# Should be removed in 8.4, after CI files migration has been done.
#
def
old_dir_to_trace
File
.
join
(
Settings
.
gitlab_ci
.
builds_path
,
created_at
.
utc
.
strftime
(
"%Y_%m"
),
project
.
ci_id
.
to_s
)
end
##
# Deprecated
#
# This is a hotfix for CI build data integrity, see #4246
# Should be removed in 8.4, after CI files migration has been done.
#
def
old_path_to_trace
"
#{
old_dir_to_trace
}
/
#{
id
}
.log"
end
##
# Deprecated
#
# This contains a hotfix for CI build data integrity, see #4246
#
# This method is used by `ArtifactUploader` to create a store_dir.
# Warning: Uploader uses it after AND before file has been stored.
#
# This method returns old path to artifacts only if it already exists.
#
def
artifacts_path
old
=
File
.
join
(
created_at
.
utc
.
strftime
(
'%Y_%m'
),
project
.
ci_id
.
to_s
,
id
.
to_s
)
old_store
=
File
.
join
(
ArtifactUploader
.
artifacts_path
,
old
)
return
old
if
project
.
ci_id
&&
File
.
directory?
(
old_store
)
File
.
join
(
created_at
.
utc
.
strftime
(
'%Y_%m'
),
project
.
id
.
to_s
,
id
.
to_s
)
end
def
token
project
.
runners_token
end
...
...
app/uploaders/artifact_uploader.rb
View file @
333d3d9e
...
...
@@ -20,16 +20,12 @@ class ArtifactUploader < CarrierWave::Uploader::Base
@build
,
@field
=
build
,
field
end
def
artifacts_path
File
.
join
(
build
.
created_at
.
utc
.
strftime
(
'%Y_%m'
),
build
.
project
.
id
.
to_s
,
build
.
id
.
to_s
)
end
def
store_dir
File
.
join
(
ArtifactUploader
.
artifacts_path
,
artifacts_path
)
File
.
join
(
self
.
class
.
artifacts_path
,
@build
.
artifacts_path
)
end
def
cache_dir
File
.
join
(
ArtifactUploader
.
artifacts_cache_path
,
artifacts_path
)
File
.
join
(
self
.
class
.
artifacts_cache_path
,
@build
.
artifacts_path
)
end
def
file_storage?
...
...
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