Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
4deeea186fa6
Commit
4deeea18
authored
Apr 26, 2018
by
Shinya Maeda
Browse files
Fix specs. Align with the new table name ci_build_trace_chunk
parent
025b16127355
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/models/ci/build.rb
View file @
4deeea18
...
...
@@ -19,10 +19,10 @@
has_one
:last_deployment
,
->
{
order
(
'deployments.id DESC'
)
},
as: :deployable
,
class_name:
'Deployment'
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_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_trace
,
->
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:trace
])
},
class_name:
'Ci::JobArtifact'
,
inverse_of: :job
,
foreign_key: :job_id
...
...
@@ -23,14 +23,9 @@
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_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
<<<<<<<
HEAD
has_many
:chunks
,
class_name:
'Ci::JobTraceChunk'
,
foreign_key: :job_id
=======
>>>>>>>
live
-
trace
-
v2
has_one
:metadata
,
class_name:
'Ci::BuildMetadata'
delegate
:timeout
,
to: :metadata
,
prefix:
true
,
allow_nil:
true
delegate
:gitlab_deploy_token
,
to: :project
...
...
app/models/ci/build_trace_chunk.rb
View file @
4deeea18
...
...
@@ -19,5 +19,4 @@
db:
2
}
<<<<<<<
HEAD
:app
/
models
/
ci
/
job_trace_chunk
.
rb
def
self
.
delayed_cleanup_blk
...
...
@@ -23,5 +22,5 @@
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"
end
...
...
@@ -44,6 +43,5 @@
end
end
=======
##
# Data is memoized for optimizing #size and #end_offset
...
...
@@ -48,6 +46,5 @@
##
# Data is memoized for optimizing #size and #end_offset
>>>>>>>
live
-
trace
-
v2
:app
/
models
/
ci
/
build_trace_chunk
.
rb
def
data
@data
||=
get_data
end
...
...
app/models/project.rb
View file @
4deeea18
...
...
@@ -228,7 +228,7 @@
# still using `dependent: :destroy` here.
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_chunks
,
class_name:
'Ci::
Job
TraceChunk'
,
foreign_key: :job_id
,
through: :builds
,
source: :chunks
has_many
:build_trace_chunks
,
class_name:
'Ci::
Build
TraceChunk'
,
through: :builds
,
source: :
trace_
chunks
has_many
:runner_projects
,
class_name:
'Ci::RunnerProject'
has_many
:runners
,
through: :runner_projects
,
source: :runner
,
class_name:
'Ci::Runner'
has_many
:variables
,
class_name:
'Ci::Variable'
...
...
app/workers/build_finished_worker.rb
View file @
4deeea18
...
...
@@ -8,7 +8,7 @@
Ci
::
Build
.
find_by
(
id:
build_id
).
try
do
|
build
|
# Swap all trace chunks to Database from Redis
# 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
BuildTraceSectionsWorker
.
new
.
perform
(
build
.
id
)
...
...
lib/gitlab/ci/trace.rb
View file @
4deeea18
...
...
@@ -111,7 +111,7 @@
if
job
.
trace_chunks
.
any?
Gitlab
::
Ci
::
Trace
::
ChunkedIO
.
new
(
job
)
do
|
stream
|
archive_stream!
(
stream
)
stream
.
de
lete
!
stream
.
de
stroy
!
end
elsif
current_path
File
.
open
(
current_path
)
do
|
stream
|
...
...
spec/lib/gitlab/import_export/all_models.yml
View file @
4deeea18
...
...
@@ -276,6 +276,7 @@
-
uploads
-
members_and_requesters
-
build_trace_section_names
-
build_trace_chunks
-
root_of_fork_network
-
fork_network_member
-
fork_network
...
...
Write
Preview
Supports
Markdown
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