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
Jérome Perrin
gitlab-ce
Commits
ab02bd69
Commit
ab02bd69
authored
Nov 30, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `job_artifacts_archive|metadata`
parent
8f01e679
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/models/concerns/artifact_migratable.rb
app/models/concerns/artifact_migratable.rb
+8
-8
spec/services/ci/retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+1
-1
spec/services/projects/update_pages_service_spec.rb
spec/services/projects/update_pages_service_spec.rb
+1
-1
spec/workers/expire_build_instance_artifacts_worker_spec.rb
spec/workers/expire_build_instance_artifacts_worker_spec.rb
+3
-3
No files found.
app/models/ci/build.rb
View file @
ab02bd69
...
...
@@ -16,8 +16,8 @@ module Ci
has_many
:trace_sections
,
class_name:
'Ci::BuildTraceSection'
has_many
:job_artifacts
,
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
,
dependent: :destroy
# rubocop:disable Cop/ActiveRecordDependent
has_one
:job_archive
,
->
()
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:archive
])
},
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
has_one
:job_metadata
,
->
()
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:metadata
])
},
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
has_one
:job_ar
tifacts_ar
chive
,
->
()
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:archive
])
},
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
has_one
:job_
artifacts_
metadata
,
->
()
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:metadata
])
},
class_name:
'Ci::JobArtifact'
,
foreign_key: :job_id
# The "environment" field for builds is a String, and is the unexpanded name
def
persisted_environment
...
...
app/models/concerns/artifact_migratable.rb
View file @
ab02bd69
...
...
@@ -3,11 +3,11 @@
# Meant to be prepended so the interface can stay the same
module
ArtifactMigratable
def
artifacts_file
job_archive
&
.
file
||
legacy_artifacts_file
job_ar
tifacts_ar
chive
&
.
file
||
legacy_artifacts_file
end
def
artifacts_metadata
job_metadata
&
.
file
||
legacy_artifacts_metadata
job_
artifacts_
metadata
&
.
file
||
legacy_artifacts_metadata
end
def
artifacts?
...
...
@@ -19,20 +19,20 @@ module ArtifactMigratable
end
def
artifacts_file_changed?
job_archive
&
.
file_changed?
||
attribute_changed?
(
:artifacts_file
)
job_ar
tifacts_ar
chive
&
.
file_changed?
||
attribute_changed?
(
:artifacts_file
)
end
def
remove_artifacts_file!
if
job_archive
job_archive
.
destroy
if
job_ar
tifacts_ar
chive
job_ar
tifacts_ar
chive
.
destroy
else
remove_legacy_artifacts_file!
end
end
def
remove_artifacts_metadata!
if
job_metadata
job_metadata
.
destroy
if
job_
artifacts_
metadata
job_
artifacts_
metadata
.
destroy
else
remove_legacy_artifacts_metadata!
end
...
...
@@ -40,6 +40,6 @@ module ArtifactMigratable
def
artifacts_size
read_attribute
(
:artifacts_size
).
to_i
+
job_ar
chive
&
.
size
.
to_i
+
job
_metadata
&
.
size
.
to_i
job_ar
tifacts_archive
&
.
size
.
to_i
+
job_artifacts
_metadata
&
.
size
.
to_i
end
end
spec/services/ci/retry_build_service_spec.rb
View file @
ab02bd69
...
...
@@ -17,7 +17,7 @@ describe Ci::RetryBuildService do
%i[id status user token coverage trace runner artifacts_expire_at
artifacts_file artifacts_metadata artifacts_size created_at
updated_at started_at finished_at queued_at erased_by
erased_at auto_canceled_by job_artifacts job_ar
chive job
_metadata]
.
freeze
erased_at auto_canceled_by job_artifacts job_ar
tifacts_archive job_artifacts
_metadata]
.
freeze
IGNORE_ACCESSORS
=
%i[type lock_version target_url base_tags trace_sections
...
...
spec/services/projects/update_pages_service_spec.rb
View file @
ab02bd69
...
...
@@ -155,7 +155,7 @@ describe Projects::UpdatePagesService do
end
it
'fails for empty file fails'
do
build
.
job_archive
.
update_attributes
(
file:
empty_file
)
build
.
job_ar
tifacts_ar
chive
.
update_attributes
(
file:
empty_file
)
expect
(
execute
).
not_to
eq
(
:success
)
end
...
...
spec/workers/expire_build_instance_artifacts_worker_spec.rb
View file @
ab02bd69
...
...
@@ -23,7 +23,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end
it
'does remove the job artifact record'
do
expect
(
build
.
reload
.
job_archive
).
to
be_nil
expect
(
build
.
reload
.
job_ar
tifacts_ar
chive
).
to
be_nil
end
end
end
...
...
@@ -42,7 +42,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end
it
'does not remove the job artifact record'
do
expect
(
build
.
reload
.
job_archive
).
not_to
be_nil
expect
(
build
.
reload
.
job_ar
tifacts_ar
chive
).
not_to
be_nil
end
end
...
...
@@ -58,7 +58,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end
it
'does not remove the job artifact record'
do
expect
(
build
.
reload
.
job_archive
).
not_to
be_nil
expect
(
build
.
reload
.
job_ar
tifacts_ar
chive
).
not_to
be_nil
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