Skip to content

Add GraphQL field `readme_html` to CiCatalogResource

Leaminn Ma requested to merge add-readme-gql-field-ci-catalog into master

What does this MR do and why?

Added the readme_html field to ciCatalogResource in GraphQL.

This field returns the content of the catalog resource's README file converted from markdown to HTML.

Resolves #408721 (closed).

How to set up and validate locally

  1. In the Rails console, run Feature.enable(:ci_private_catalog_beta) and Feature.enable(:ci_namespace_catalog_experimental).
  2. Create a Catalog Resource with an existing or new Project:
::Ci::Catalog::Resource.create(project: Project.find(<project_id>))
  1. Ensure your Project contains a README.md file with some GFLM content. Sample content:
# Test Header

**Test Bold Text**
  1. Go to http://gdk.test:3000/-/graphql-explorer and run the following query (adjust the projectPath as necessary):
query getCiCatalogResources {
  ciCatalogResources(projectPath: "group-a/project-catalog-resource-2") {
    nodes {
      id
      name
      readmeHtml
    }
  }
}
  1. Observe that the output shows the README.md content converted to HTML.
Screenshot Screenshot_2023-05-31_at_4.50.36_PM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #408721 (closed)

Edited by Leaminn Ma

Merge request reports