Skip to content

Add endpoint to update list of X-Ray dependencies

What does this MR do and why?

Adds a blank API endpoint to receive list of dependencies from X-Ray.

Related to gitlab-org/code-creation/repository-x-ray#31 (closed) and https://gitlab.com/gitlab-org/code-creation/repository-x-ray/-/issues/24

Implements #467340 (closed)

SQL queries

upsert

INSERT INTO "xray_reports" ("project_id","payload","lang","file_checksum","created_at","updated_at")
VALUES (
  278964,
  '{"scannerVersion":"2.0.0","checksum":"ac2cb98b21a0fd2850b4276a345c1e54a29946b88db10e1940e496b071b00806","libs":[{"name":"rails"},{"name":"devise"},{"name":"attr_encrypted"},{"name":"grape"},{"name":"kaminari"}]}',
  'Ruby',
  '\x61633263623938623231613066643238353062343237366133343563316535346132393934366238386462313065313934306534393662303731623030383036',
  CURRENT_TIMESTAMP,
  CURRENT_TIMESTAMP
)
ON CONFLICT ("project_id","lang")
DO UPDATE SET updated_at=(CASE WHEN ("xray_reports"."payload" IS NOT DISTINCT FROM excluded."payload" AND "xray_reports"."file_checksum" IS NOT DISTINCT FROM excluded."file_checksum") THEN "xray_reports".updated_at ELSE CURRENT_TIMESTAMP END),"payload"=excluded."payload","file_checksum"=excluded."file_checksum" RETURNING "id"

Plan: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/29507/commands/91640

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Vitali Tatarintev

Merge request reports