BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
afcc57ab
Unverified
Commit
afcc57ab
authored
Mar 20, 2018
by
Tomasz Maczukin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename metadata relation and methods
parent
4c348234
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
build.rb
app/models/ci/build.rb
+5
-5
build_details_entity.rb
app/serializers/build_details_entity.rb
+3
-1
build_spec.rb
spec/models/ci/build_spec.rb
+2
-2
retry_build_service_spec.rb
spec/services/ci/retry_build_service_spec.rb
+1
-1
No files found.
app/models/ci/build.rb
View file @
afcc57ab
...
...
@@ -24,7 +24,7 @@ module Ci
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
has_one
:
build_
metadata
,
class_name:
'Ci::BuildMetadata'
has_one
:metadata
,
class_name:
'Ci::BuildMetadata'
# The "environment" field for builds is a String, and is the unexpanded name
def
persisted_environment
...
...
@@ -157,12 +157,12 @@ module Ci
end
before_transition
pending: :running
do
|
build
|
build
.
metadata
.
save_timeout_state!
build
.
ensure_
metadata
.
save_timeout_state!
end
end
def
metadata
self
.
build_metadata
||=
Ci
::
BuildMetadata
.
new
def
ensure_
metadata
metadata
||
build_metadata
end
def
detailed_status
(
current_user
)
...
...
@@ -242,7 +242,7 @@ module Ci
end
def
timeout
metadata
.
timeout
ensure_
metadata
.
timeout
end
def
triggered_by?
(
current_user
)
...
...
app/serializers/build_details_entity.rb
View file @
afcc57ab
...
...
@@ -5,7 +5,9 @@ class BuildDetailsEntity < JobEntity
expose
:runner
,
using:
RunnerEntity
expose
:pipeline
,
using:
PipelineEntity
expose
:metadata
,
using:
BuildMetadataEntity
expose
:metadata
,
using:
BuildMetadataEntity
do
|
build
|
build
.
ensure_metadata
end
expose
:erased_by
,
if:
->
(
*
)
{
build
.
erased?
},
using:
UserEntity
expose
:erase_path
,
if:
->
(
*
)
{
build
.
erasable?
&&
can?
(
current_user
,
:erase_build
,
build
)
}
do
|
build
|
...
...
spec/models/ci/build_spec.rb
View file @
afcc57ab
...
...
@@ -2052,11 +2052,11 @@ describe Ci::Build do
shared_examples
'saves data on transition'
do
it
'saves timeout'
do
expect
{
job
.
run!
}.
to
change
{
job
.
reload
.
metadata
.
timeout
}.
from
(
nil
).
to
(
expected_timeout
)
expect
{
job
.
run!
}.
to
change
{
job
.
reload
.
ensure_
metadata
.
timeout
}.
from
(
nil
).
to
(
expected_timeout
)
end
it
'saves timeout_source'
do
expect
{
job
.
run!
}.
to
change
{
job
.
reload
.
metadata
.
timeout_source
}.
from
(
'unknown_timeout_source'
).
to
(
expected_timeout_source
)
expect
{
job
.
run!
}.
to
change
{
job
.
reload
.
ensure_
metadata
.
timeout_source
}.
from
(
'unknown_timeout_source'
).
to
(
expected_timeout_source
)
end
end
...
...
spec/services/ci/retry_build_service_spec.rb
View file @
afcc57ab
...
...
@@ -30,7 +30,7 @@ describe Ci::RetryBuildService do
runner_id tag_taggings taggings tags trigger_request_id
user_id auto_canceled_by_id retried failure_reason
artifacts_file_store artifacts_metadata_store
build_
metadata]
.
freeze
metadata]
.
freeze
shared_examples
'build duplication'
do
let
(
:another_pipeline
)
{
create
(
:ci_empty_pipeline
,
project:
project
)
}
...
...
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