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
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
...
@@ -16,8 +16,8 @@ module Ci
has_many
:trace_sections
,
class_name:
'Ci::BuildTraceSection'
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_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_ar
tifacts_ar
chive
,
->
()
{
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_
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
# The "environment" field for builds is a String, and is the unexpanded name
def
persisted_environment
def
persisted_environment
...
...
app/models/concerns/artifact_migratable.rb
View file @
ab02bd69
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
# Meant to be prepended so the interface can stay the same
# Meant to be prepended so the interface can stay the same
module
ArtifactMigratable
module
ArtifactMigratable
def
artifacts_file
def
artifacts_file
job_archive
&
.
file
||
legacy_artifacts_file
job_ar
tifacts_ar
chive
&
.
file
||
legacy_artifacts_file
end
end
def
artifacts_metadata
def
artifacts_metadata
job_metadata
&
.
file
||
legacy_artifacts_metadata
job_
artifacts_
metadata
&
.
file
||
legacy_artifacts_metadata
end
end
def
artifacts?
def
artifacts?
...
@@ -19,20 +19,20 @@ module ArtifactMigratable
...
@@ -19,20 +19,20 @@ module ArtifactMigratable
end
end
def
artifacts_file_changed?
def
artifacts_file_changed?
job_archive
&
.
file_changed?
||
attribute_changed?
(
:artifacts_file
)
job_ar
tifacts_ar
chive
&
.
file_changed?
||
attribute_changed?
(
:artifacts_file
)
end
end
def
remove_artifacts_file!
def
remove_artifacts_file!
if
job_archive
if
job_ar
tifacts_ar
chive
job_archive
.
destroy
job_ar
tifacts_ar
chive
.
destroy
else
else
remove_legacy_artifacts_file!
remove_legacy_artifacts_file!
end
end
end
end
def
remove_artifacts_metadata!
def
remove_artifacts_metadata!
if
job_metadata
if
job_
artifacts_
metadata
job_metadata
.
destroy
job_
artifacts_
metadata
.
destroy
else
else
remove_legacy_artifacts_metadata!
remove_legacy_artifacts_metadata!
end
end
...
@@ -40,6 +40,6 @@ module ArtifactMigratable
...
@@ -40,6 +40,6 @@ module ArtifactMigratable
def
artifacts_size
def
artifacts_size
read_attribute
(
:artifacts_size
).
to_i
+
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
end
end
spec/services/ci/retry_build_service_spec.rb
View file @
ab02bd69
...
@@ -17,7 +17,7 @@ describe Ci::RetryBuildService do
...
@@ -17,7 +17,7 @@ describe Ci::RetryBuildService do
%i[id status user token coverage trace runner artifacts_expire_at
%i[id status user token coverage trace runner artifacts_expire_at
artifacts_file artifacts_metadata artifacts_size created_at
artifacts_file artifacts_metadata artifacts_size created_at
updated_at started_at finished_at queued_at erased_by
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
=
IGNORE_ACCESSORS
=
%i[type lock_version target_url base_tags trace_sections
%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
...
@@ -155,7 +155,7 @@ describe Projects::UpdatePagesService do
end
end
it
'fails for empty file fails'
do
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
)
expect
(
execute
).
not_to
eq
(
:success
)
end
end
...
...
spec/workers/expire_build_instance_artifacts_worker_spec.rb
View file @
ab02bd69
...
@@ -23,7 +23,7 @@ describe ExpireBuildInstanceArtifactsWorker do
...
@@ -23,7 +23,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end
end
it
'does remove the job artifact record'
do
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
end
end
end
...
@@ -42,7 +42,7 @@ describe ExpireBuildInstanceArtifactsWorker do
...
@@ -42,7 +42,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end
end
it
'does not remove the job artifact record'
do
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
end
end
...
@@ -58,7 +58,7 @@ describe ExpireBuildInstanceArtifactsWorker do
...
@@ -58,7 +58,7 @@ describe ExpireBuildInstanceArtifactsWorker do
end
end
it
'does not remove the job artifact record'
do
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
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