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
9fac26f6
Commit
9fac26f6
authored
Sep 30, 2019
by
Cameron Swords
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed scopes to better describe what they do
parent
2d8ba98d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
ee/app/finders/security/jobs_finder.rb
ee/app/finders/security/jobs_finder.rb
+3
-3
No files found.
app/models/ci/build.rb
View file @
9fac26f6
...
...
@@ -128,9 +128,9 @@ module Ci
scope
:with_stale_live_trace
,
->
{
with_live_trace
.
finished_before
(
12
.
hours
.
ago
)
}
scope
:finished_before
,
->
(
date
)
{
finished
.
where
(
'finished_at < ?'
,
date
)
}
scope
:with_secure_report
_legacy
,
->
(
job_type
)
{
where
(
'options like :job_type'
,
job_type:
"%:artifacts:%:reports:%:
#{
job_type
}
:%"
)
}
scope
:with_secure_report
s_from_options
,
->
(
job_type
)
{
where
(
'options like :job_type'
,
job_type:
"%:artifacts:%:reports:%:
#{
job_type
}
:%"
)
}
scope
:with_secure_reports
,
->
(
job_types
)
do
scope
:with_secure_reports
_from_config_options
,
->
(
job_types
)
do
joins
(
:metadata
).
where
(
"ci_builds_metadata.config_options -> 'artifacts' -> 'reports' ?| array[:job_types]"
,
job_types:
job_types
)
end
...
...
ee/app/finders/security/jobs_finder.rb
View file @
9fac26f6
...
...
@@ -51,16 +51,16 @@ module Security
end
def
find_jobs
(
job_types
)
@pipeline
.
builds
.
with_secure_reports
(
job_types
)
@pipeline
.
builds
.
with_secure_reports
_from_config_options
(
job_types
)
end
def
find_jobs_legacy
(
job_types
)
# first job type is added as a WHERE statement
query
=
@pipeline
.
builds
.
with_secure_report
_legacy
(
job_types
.
first
)
query
=
@pipeline
.
builds
.
with_secure_report
s_from_options
(
job_types
.
first
)
# following job types are added as OR statements
jobs
=
job_types
.
drop
(
1
).
reduce
(
query
)
do
|
qry
,
job_type
|
qry
.
or
(
@pipeline
.
builds
.
with_secure_report
_legacy
(
job_type
))
qry
.
or
(
@pipeline
.
builds
.
with_secure_report
s_from_options
(
job_type
))
end
# the query doesn't guarantee accuracy, so we verify it here
...
...
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