Skip to content

Bug: Relative URL breaks CI/CD component catalog project reference

Summary

On GitLab 16.9.0, hosting GitLab under a relative URL breaks the CI/CD components catalog UI.

Customer affected by this bug:

CSM: @ssharer1

Steps to reproduce

  1. Host GitLab under a relative URL
  2. Publish a CI/CD component project (docs link)
  3. Visit catalog project

Example Project

What is the current bug behavior?

The GraphQL variable fullPath returns /gitlab/project. The fullPath is appended to the end of the URI, resulting in a 404:

https://domain.com/gitlab/explore/catalog/gitlab/project/name

What is the expected correct behavior?

The project URL reference should correctly link to the catalog project like so:

https://domain.com/gitlab/explore/catalog/project/name

Relevant logs and/or screenshots

{
  "severity": "INFO",
  "time": "2024-03-19T20:52:19.705Z",
  "correlation_id": "01HSC7S1K22X9RRB2JG26NFT3X",
  "meta.caller_id": "graphql:getCiCatalogResourceDetails",
  "meta.remote_ip": "[REDACTED]",
  "meta.feature_category": "pipeline_composition",
  "meta.user": "[REDACTED]",
  "meta.user_id": 156,
  "meta.client_id": "user/156",
  "trace_type": "execute_query",
  "query_fingerprint": "getCiCatalogResourceDetails/E8m25HHusApoi3LuGF09UDWrJxAcJS84kuYc2ywtHCQ=/1/9boazeZzKxJS8EhiUa_mn3kjWVhX-u5gwL5TtJXmxI4=",
  "duration_s": 0.002968349028378725,
  "operation_name": "getCiCatalogResourceDetails",
  "operation_fingerprint": "getCiCatalogResourceDetails/E8m25HHusApoi3LuGF09UDWrJxAcJS84kuYc2ywtHCQ=",
  "is_mutation": false,
  "variables": "{\"fullPath\"=>\"gitlab/[REDACTED]\"}",
  "query_string": "query getCiCatalogResourceDetails($fullPath: ID!) {\n  ciCatalogResource(fullPath: $fullPath) {\n    id\n    webPath\n    openIssuesCount\n    openMergeRequestsCount\n    versions(first: 1) {\n      nodes {\n        id\n        commit {\n          id\n          pipelines(first: 1) {\n            nodes {\n              id\n              detailedStatus {\n                id\n                detailsPath\n                icon\n                text\n                group\n                __typename\n              }\n              __typename\n            }\n            __typename\n          }\n          __typename\n        }\n        name\n        releasedAt\n        __typename\n      }\n      __typename\n    }\n    __typename\n  }\n}\n",
  "query_analysis.duration_s": 0.0014012129977345467,
  "query_analysis.depth": 8,
  "query_analysis.complexity": 37,
  "query_analysis.used_fields": [
    "CiCatalogResource.id",
    "CiCatalogResource.webPath",
    "CiCatalogResource.openIssuesCount",
    "CiCatalogResource.openMergeRequestsCount",
    "CiCatalogResourceVersion.id",
    "Commit.id",
    "Pipeline.id",
    "DetailedStatus.id",
    "DetailedStatus.detailsPath",
    "DetailedStatus.icon",
    "DetailedStatus.text",
    "DetailedStatus.group",
    "DetailedStatus.__typename",
    "Pipeline.detailedStatus",
    "Pipeline.__typename",
    "PipelineConnection.nodes",
    "PipelineConnection.__typename",
    "Commit.pipelines",
    "Commit.__typename",
    "CiCatalogResourceVersion.commit",
    "CiCatalogResourceVersion.name",
    "CiCatalogResourceVersion.releasedAt",
    "CiCatalogResourceVersion.__typename",
    "CiCatalogResourceVersionConnection.nodes",
    "CiCatalogResourceVersionConnection.__typename",
    "CiCatalogResource.versions",
    "CiCatalogResource.__typename",
    "Query.ciCatalogResource"
  ],
  "query_analysis.used_deprecated_fields": [
    "CiCatalogResource.id",
    "CiCatalogResource.webPath",
    "CiCatalogResource.openIssuesCount",
    "CiCatalogResource.openMergeRequestsCount",
    "CiCatalogResourceVersion.id",
    "DetailedStatus.icon",
    "DetailedStatus.text",
    "DetailedStatus.group",
    "CiCatalogResourceVersion.commit",
    "CiCatalogResourceVersion.name",
    "CiCatalogResourceVersion.releasedAt",
    "CiCatalogResource.versions",
    "Query.ciCatalogResource"
  ],
  "query_analysis.used_deprecated_arguments": []
}

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Analysis

This problem occurs because the FE generates the links for the CI/CD Catalog listing by appending the project's webPath to /explore/catalog. However, a "web path" also includes the relative gitlab base URL, which breaks the link because it's not recognized as a project path. See #450914 (comment 1826495576) for details.

The fix is to expose the project's fullPath field. Then after this is released, frontend can use fullPath instead of webPath only where necessary. Some links still need to continue using webPath as explained in #450914 (comment 1832330110).

Proposal

Expose ResourceType.full_path in the GraphQl API. Then update frontend to use fullPath instead of webPath for the links on the CI/CD Catalog page.

If we want to keep FE changes minimal and also maintain backwards compatibility, the FE changes would have to be released in the next milestone. (See #450914 (comment 1836769838).)

MR Implementation

Group Link Milestone
backend Add GraphQl full_path field to ResourceType (!147623 - merged) %16.11
frontend TBD %17.0
Edited by Leaminn Ma