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
8fe37da6
Commit
8fe37da6
authored
Jul 30, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More clever way for testing runner features
parent
6f264888
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
app/models/ci/build.rb
app/models/ci/build.rb
+14
-8
No files found.
app/models/ci/build.rb
View file @
8fe37da6
...
@@ -15,6 +15,10 @@ module Ci
...
@@ -15,6 +15,10 @@ module Ci
has_many
:deployments
,
as: :deployable
has_many
:deployments
,
as: :deployable
RUNNER_FEATURES
=
{
upload_multiple_artifacts:
->
(
build
)
{
build
.
publishes_artifacts_reports?
}
}.
freeze
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
:trace_chunks
,
class_name:
'Ci::BuildTraceChunk'
,
foreign_key: :build_id
has_many
:trace_chunks
,
class_name:
'Ci::BuildTraceChunk'
,
foreign_key: :build_id
...
@@ -337,12 +341,6 @@ module Ci
...
@@ -337,12 +341,6 @@ module Ci
{
trace_sections:
true
}
{
trace_sections:
true
}
end
end
def
runner_required_features
features
=
[]
features
<<
:upload_multiple_artifacts
if
publishes_artifacts_reports?
features
end
def
merge_request
def
merge_request
return
@merge_request
if
defined?
(
@merge_request
)
return
@merge_request
if
defined?
(
@merge_request
)
...
@@ -594,14 +592,22 @@ module Ci
...
@@ -594,14 +592,22 @@ module Ci
true
true
end
end
def
runner_required_feature_names
strong_memoize
(
:runner_required_feature_names
)
do
RUNNER_FEATURES
.
select
do
|
feature
,
method
|
method
.
call
(
self
)
end
.
keys
end
end
def
supported_runner?
(
features
)
def
supported_runner?
(
features
)
runner_required_features
.
all?
do
|
feature_name
|
runner_required_feature
_name
s
.
all?
do
|
feature_name
|
features
&
.
dig
(
feature_name
)
features
&
.
dig
(
feature_name
)
end
end
end
end
def
publishes_artifacts_reports?
def
publishes_artifacts_reports?
options
.
dig
(
:artifacts
,
:reports
)
.
any?
options
&
.
dig
(
:artifacts
,
:reports
)
&
.
any?
end
end
def
hide_secrets
(
trace
)
def
hide_secrets
(
trace
)
...
...
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