Move some calculations of failed security job information to SQL
Why are we doing this work
The following discussions from !43906 (merged) should be addressed:
-
@minac started a discussion: (+3 comments) Hi @alexpooley
👋 Would you mind giving me the initial backend review on this? -
@nick.thomas started a discussion: (+1 comment) Can we do this in SQL instead? Something like this, maybe?
security_builds.latest.failed
If not, we could at least reduce this to a single iteration:
security_builds.select { |build| build.latest? && build.failed? }
-
@nick.thomas started a discussion: (+1 comment) Since we're filtering this further, maybe it makes sense for the filtering to happen inside the memo?
-
@nick.thomas started a discussion: (+1 comment) Thanks @minac , just a couple of questions
Relevant links
Non-functional requirements
-
Performance: Test DB performance with filtering -
Testing: Add tests for Security::SecurityJobsFinder filtering
Implementation plan
-
backend Extend Security::SecurityJobsFinder to return only the latest jobs based on a given parameter -
backend This will probably require Security::JobsFinder to include a filter
parameter in the#initialize
method -
backend Add a scope in Ci::Build for Security::JobsFinder#find_jobs
to use to filter jobs
-
Edited by Jonathan Schafer