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
Boxiang Sun
gitlab-ce
Commits
645b404d
Commit
645b404d
authored
Apr 26, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs. Align with the new table name ci_build_trace_chunk
parent
1fb66181
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
13 deletions
+6
-13
app/models/ci/build.rb
app/models/ci/build.rb
+1
-6
app/models/ci/build_trace_chunk.rb
app/models/ci/build_trace_chunk.rb
+1
-4
app/models/project.rb
app/models/project.rb
+1
-1
app/workers/build_finished_worker.rb
app/workers/build_finished_worker.rb
+1
-1
lib/gitlab/ci/trace.rb
lib/gitlab/ci/trace.rb
+1
-1
spec/lib/gitlab/import_export/all_models.yml
spec/lib/gitlab/import_export/all_models.yml
+1
-0
No files found.
app/models/ci/build.rb
View file @
645b404d
...
@@ -19,18 +19,13 @@ module Ci
...
@@ -19,18 +19,13 @@ module Ci
has_one
:last_deployment
,
->
{
order
(
'deployments.id DESC'
)
},
as: :deployable
,
class_name:
'Deployment'
has_one
:last_deployment
,
->
{
order
(
'deployments.id DESC'
)
},
as: :deployable
,
class_name:
'Deployment'
has_many
:trace_sections
,
class_name:
'Ci::BuildTraceSection'
has_many
:trace_sections
,
class_name:
'Ci::BuildTraceSection'
has_many
:trace_chunks
,
class_name:
'Ci::BuildTraceChunk'
,
foreign_key: :build_id
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:trace_chunks
,
class_name:
'Ci::BuildTraceChunk'
,
foreign_key: :build_id
has_many
:job_artifacts
,
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
,
dependent: :destroy
,
inverse_of: :job
# rubocop:disable Cop/ActiveRecordDependent
has_many
:job_artifacts
,
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
,
dependent: :destroy
,
inverse_of: :job
# rubocop:disable Cop/ActiveRecordDependent
has_one
:job_artifacts_archive
,
->
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:archive
])
},
class_name:
'Ci::JobArtifact'
,
inverse_of: :job
,
foreign_key: :job_id
has_one
:job_artifacts_archive
,
->
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:archive
])
},
class_name:
'Ci::JobArtifact'
,
inverse_of: :job
,
foreign_key: :job_id
has_one
:job_artifacts_metadata
,
->
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:metadata
])
},
class_name:
'Ci::JobArtifact'
,
inverse_of: :job
,
foreign_key: :job_id
has_one
:job_artifacts_metadata
,
->
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:metadata
])
},
class_name:
'Ci::JobArtifact'
,
inverse_of: :job
,
foreign_key: :job_id
has_one
:job_artifacts_trace
,
->
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:trace
])
},
class_name:
'Ci::JobArtifact'
,
inverse_of: :job
,
foreign_key: :job_id
has_one
:job_artifacts_trace
,
->
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:trace
])
},
class_name:
'Ci::JobArtifact'
,
inverse_of: :job
,
foreign_key: :job_id
<<<<<<<
HEAD
has_many
:chunks
,
class_name:
'Ci::JobTraceChunk'
,
foreign_key: :job_id
=======
>>>>>>>
live
-
trace
-
v2
has_one
:metadata
,
class_name:
'Ci::BuildMetadata'
has_one
:metadata
,
class_name:
'Ci::BuildMetadata'
delegate
:timeout
,
to: :metadata
,
prefix:
true
,
allow_nil:
true
delegate
:timeout
,
to: :metadata
,
prefix:
true
,
allow_nil:
true
delegate
:gitlab_deploy_token
,
to: :project
delegate
:gitlab_deploy_token
,
to: :project
...
...
app/models/ci/build_trace_chunk.rb
View file @
645b404d
...
@@ -19,9 +19,8 @@ module Ci
...
@@ -19,9 +19,8 @@ module Ci
db:
2
db:
2
}
}
<<<<<<<
HEAD
:app
/
models
/
ci
/
job_trace_chunk
.
rb
def
self
.
delayed_cleanup_blk
def
self
.
delayed_cleanup_blk
ids
=
all
.
redis
.
pluck
(
:
job
_id
,
:chunk_index
).
map
do
|
data
|
ids
=
all
.
redis
.
pluck
(
:
build
_id
,
:chunk_index
).
map
do
|
data
|
"gitlab:ci:trace:
#{
data
.
first
}
:chunks:
#{
data
.
second
}
:data"
"gitlab:ci:trace:
#{
data
.
first
}
:chunks:
#{
data
.
second
}
:data"
end
end
...
@@ -44,10 +43,8 @@ module Ci
...
@@ -44,10 +43,8 @@ module Ci
end
end
end
end
=======
##
##
# Data is memoized for optimizing #size and #end_offset
# Data is memoized for optimizing #size and #end_offset
>>>>>>>
live
-
trace
-
v2
:app
/
models
/
ci
/
build_trace_chunk
.
rb
def
data
def
data
@data
||=
get_data
@data
||=
get_data
end
end
...
...
app/models/project.rb
View file @
645b404d
...
@@ -228,7 +228,7 @@ class Project < ActiveRecord::Base
...
@@ -228,7 +228,7 @@ class Project < ActiveRecord::Base
# still using `dependent: :destroy` here.
# still using `dependent: :destroy` here.
has_many
:builds
,
class_name:
'Ci::Build'
,
inverse_of: :project
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:builds
,
class_name:
'Ci::Build'
,
inverse_of: :project
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_many
:build_trace_section_names
,
class_name:
'Ci::BuildTraceSectionName'
has_many
:build_trace_section_names
,
class_name:
'Ci::BuildTraceSectionName'
has_many
:build_trace_chunks
,
class_name:
'Ci::
JobTraceChunk'
,
foreign_key: :job_id
,
through: :builds
,
source: :
chunks
has_many
:build_trace_chunks
,
class_name:
'Ci::
BuildTraceChunk'
,
through: :builds
,
source: :trace_
chunks
has_many
:runner_projects
,
class_name:
'Ci::RunnerProject'
has_many
:runner_projects
,
class_name:
'Ci::RunnerProject'
has_many
:runners
,
through: :runner_projects
,
source: :runner
,
class_name:
'Ci::Runner'
has_many
:runners
,
through: :runner_projects
,
source: :runner
,
class_name:
'Ci::Runner'
has_many
:variables
,
class_name:
'Ci::Variable'
has_many
:variables
,
class_name:
'Ci::Variable'
...
...
app/workers/build_finished_worker.rb
View file @
645b404d
...
@@ -8,7 +8,7 @@ class BuildFinishedWorker
...
@@ -8,7 +8,7 @@ class BuildFinishedWorker
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
# Swap all trace chunks to Database from Redis
# Swap all trace chunks to Database from Redis
# TODO: Do we need that?
# TODO: Do we need that?
build
.
chunks
.
redis
.
map
(
&
:use_database!
)
build
.
trace_
chunks
.
redis
.
map
(
&
:use_database!
)
# We execute that in sync as this access the files in order to access local data, and reduce IO
# We execute that in sync as this access the files in order to access local data, and reduce IO
BuildTraceSectionsWorker
.
new
.
perform
(
build
.
id
)
BuildTraceSectionsWorker
.
new
.
perform
(
build
.
id
)
...
...
lib/gitlab/ci/trace.rb
View file @
645b404d
...
@@ -111,7 +111,7 @@ module Gitlab
...
@@ -111,7 +111,7 @@ module Gitlab
if
job
.
trace_chunks
.
any?
if
job
.
trace_chunks
.
any?
Gitlab
::
Ci
::
Trace
::
ChunkedIO
.
new
(
job
)
do
|
stream
|
Gitlab
::
Ci
::
Trace
::
ChunkedIO
.
new
(
job
)
do
|
stream
|
archive_stream!
(
stream
)
archive_stream!
(
stream
)
stream
.
de
lete
!
stream
.
de
stroy
!
end
end
elsif
current_path
elsif
current_path
File
.
open
(
current_path
)
do
|
stream
|
File
.
open
(
current_path
)
do
|
stream
|
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
645b404d
...
@@ -276,6 +276,7 @@ project:
...
@@ -276,6 +276,7 @@ project:
-
uploads
-
uploads
-
members_and_requesters
-
members_and_requesters
-
build_trace_section_names
-
build_trace_section_names
-
build_trace_chunks
-
root_of_fork_network
-
root_of_fork_network
-
fork_network_member
-
fork_network_member
-
fork_network
-
fork_network
...
...
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