Skip to content

Store daily code coverage

Erick Bajao requested to merge eb-code-coverage-graph-storage into master

What does this MR do?

This is the first piece of work for #199455 (closed)

In this MR, I implemented how we're gonna store the daily code coverage values per project. We only want to store the coverage values when the pipeline is successful. This is to be consistent with how we fetch coverage values for our badges: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/badge/coverage/report.rb#L17

I did my best to cover all possible race conditions here but one thing that I couldn't is this: When there are no coverage records yet for the day, and then for some reason 2 pipeline success workers simultaneously got executed. Only one of these workers would be taken into consideration. The only problem is if the worker for the older pipeline was the first one to insert the record (the other newer worker would end up with the uniqueness validation error), so there's the potential that we'll get the outdated coverage value for that day, until of course they run another pipeline and bump the coverage value. So I think this is fine, as it seems to be a rare edge case and easily resolvable by a re-run of the pipeline.

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Kamil Trzciński

Merge request reports