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
Léo-Paul Géneau
gitlab-ce
Commits
303f165c
Commit
303f165c
authored
Nov 02, 2017
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix creation of job_artifact_uploader
parent
61864a5a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
12 deletions
+10
-12
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/uploaders/job_artifact_uploader.rb
app/uploaders/job_artifact_uploader.rb
+0
-6
spec/factories/ci/builds.rb
spec/factories/ci/builds.rb
+4
-2
spec/factories/ci/job_artifacts.rb
spec/factories/ci/job_artifacts.rb
+4
-2
No files found.
app/models/ci/build.rb
View file @
303f165c
...
...
@@ -15,11 +15,11 @@ module Ci
has_one
:last_deployment
,
->
{
order
(
'deployments.id DESC'
)
},
as: :deployable
,
class_name:
'Deployment'
has_many
:trace_sections
,
class_name:
'Ci::BuildTraceSection'
has_many
:job_artifacts
,
class_name:
'Ci::JobArtifact'
,
foreign_key: :ci_job_id
# TODO: what to do with dependent destroy
has_many
:job_artifacts
,
class_name:
'Ci::JobArtifact'
,
foreign_key: :ci_job_id
,
dependent: :destroy
has_one
:job_archive
,
->
()
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:archive
])
},
class_name:
'Ci::JobArtifact'
,
foreign_key: :ci_job_id
has_one
:job_metadata
,
->
()
{
where
(
file_type:
Ci
::
JobArtifact
.
file_types
[
:metadata
])
},
class_name:
'Ci::JobArtifact'
,
foreign_key: :ci_job_id
# The "environment" field for builds is a String, and is the unexpanded name
def
persisted_environment
@persisted_environment
||=
Environment
.
find_by
(
...
...
app/uploaders/job_artifact_uploader.rb
View file @
303f165c
...
...
@@ -3,12 +3,6 @@ class JobArtifactUploader < ArtifactUploader
@artifact
=
artifact
end
# If this record exists, the associatied artifact is there. Every artifact
# persisted will have an associated file
def
exists?
true
end
def
size
return
super
unless
@artifact
.
size
...
...
spec/factories/ci/builds.rb
View file @
303f165c
...
...
@@ -155,8 +155,10 @@ FactoryGirl.define do
end
trait
:artifacts
do
job_archive
factory: :ci_job_artifact
job_metadata
factory: :ci_job_metadata
after
(
:create
)
do
|
build
|
create
(
:ci_job_artifact
,
job:
build
)
create
(
:ci_job_metadata
,
job:
build
)
end
end
trait
:expired
do
...
...
spec/factories/ci/job_artifacts.rb
View file @
303f165c
...
...
@@ -2,15 +2,17 @@ include ActionDispatch::TestProcess
FactoryGirl
.
define
do
factory
:ci_job_artifact
,
class:
Ci
::
JobArtifact
do
project
job
factory: :ci_build
file_type
:archive
after
:build
do
|
artifact
|
artifact
.
project
||=
artifact
.
job
.
project
end
after
:create
do
|
artifact
|
if
artifact
.
archive?
artifact
.
file
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/ci_build_artifacts.zip'
),
'application/zip'
)
artifact
.
save
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