Skip to content

Fix codequality for merge request pipeline

Max Orefice requested to merge mo-fix-codequality-merge-request-pipeline into master

Ref:

This feature is behind a feature flag called: codequality_backend_comparison.

What does this MR do?

This MR implements the work done in !44648 (merged) but this time we do it on the backend.

Summary

This merge request adds the ability to reference the pipeline run on the target_sha of a merge request pipeline. The grouptesting recently moved the codequality comparison logic to the backend.

This solution is basically replicating what we did to cleaning up our own MergeRequest widget for report comparison on the frontend but this time we do it for the backend.

A Diagram

graph TD
  A["Commit A (master)"] --> B["Commit B (master, A+B, BASE_PIPELINE)"]
  B --> C["Commit C (master, A+B+C)"]
  B --> F["Commit F (feature, A+B+F)"]
  C --> D["Commit D (master, A+B+C+D)"]
  F --> G["Commit Z (Ephemeral merge commit, A+B+C+D+F, HEAD_PIPELINE)"]
  D --> E["Commit E (master, A+B+C+D+E)"]
  D--> G

This method exposes a pipeline run on commit D from this diagram, if it exists.

Screenshots

Currently & flag off

Screen_Shot_2020-10-15_at_4.11.23_AM

Notice the second violation Method 'drew' has 19 arguments (exceeds 4 allowed). This method was added to the target branch (master) after the merge request was opened, but remains in the merged result of this merge request.

After switching the flag on

The base_pipeline link has changed, and the artifact is fetched from a job in the more recent pipeline on master, where this violation does exist:

Screen_Shot_2020-10-15_at_4.05.37_AM

The violation no longer appears in this list, because it's in the base and no longer considered introduced.

Screen_Shot_2020-10-15_at_4.10.24_AM

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

Merge request reports