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
1
Merge Requests
1
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
nexedi
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
...
@@ -15,11 +15,11 @@ 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
: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_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
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
# The "environment" field for builds is a String, and is the unexpanded name
def
persisted_environment
def
persisted_environment
@persisted_environment
||=
Environment
.
find_by
(
@persisted_environment
||=
Environment
.
find_by
(
...
...
app/uploaders/job_artifact_uploader.rb
View file @
303f165c
...
@@ -3,12 +3,6 @@ class JobArtifactUploader < ArtifactUploader
...
@@ -3,12 +3,6 @@ class JobArtifactUploader < ArtifactUploader
@artifact
=
artifact
@artifact
=
artifact
end
end
# If this record exists, the associatied artifact is there. Every artifact
# persisted will have an associated file
def
exists?
true
end
def
size
def
size
return
super
unless
@artifact
.
size
return
super
unless
@artifact
.
size
...
...
spec/factories/ci/builds.rb
View file @
303f165c
...
@@ -155,8 +155,10 @@ FactoryGirl.define do
...
@@ -155,8 +155,10 @@ FactoryGirl.define do
end
end
trait
:artifacts
do
trait
:artifacts
do
job_archive
factory: :ci_job_artifact
after
(
:create
)
do
|
build
|
job_metadata
factory: :ci_job_metadata
create
(
:ci_job_artifact
,
job:
build
)
create
(
:ci_job_metadata
,
job:
build
)
end
end
end
trait
:expired
do
trait
:expired
do
...
...
spec/factories/ci/job_artifacts.rb
View file @
303f165c
...
@@ -2,15 +2,17 @@ include ActionDispatch::TestProcess
...
@@ -2,15 +2,17 @@ include ActionDispatch::TestProcess
FactoryGirl
.
define
do
FactoryGirl
.
define
do
factory
:ci_job_artifact
,
class:
Ci
::
JobArtifact
do
factory
:ci_job_artifact
,
class:
Ci
::
JobArtifact
do
project
job
factory: :ci_build
job
factory: :ci_build
file_type
:archive
file_type
:archive
after
:build
do
|
artifact
|
artifact
.
project
||=
artifact
.
job
.
project
end
after
:create
do
|
artifact
|
after
:create
do
|
artifact
|
if
artifact
.
archive?
if
artifact
.
archive?
artifact
.
file
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/ci_build_artifacts.zip'
),
artifact
.
file
=
fixture_file_upload
(
Rails
.
root
.
join
(
'spec/fixtures/ci_build_artifacts.zip'
),
'application/zip'
)
'application/zip'
)
artifact
.
save
artifact
.
save
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