Skip to content

Add support for rendering readme in terraform package details page

Rahul Chanila requested to merge 438060-add-the-terraform-readme-to-the-ui into master

What does this MR do and why?

Integrate Terraform module metadata into fronte... (!154567 - merged) added readme data to the terraform registry template

This MR renders the readme in terraform package details page

The Readme is added as 3rd tab which renders only when the package contains readme data.

Found a component ee/vulnerabilities/components/generic_report/types/report_type_markdown.vue which uses markdown API to render the markdown.

Moved this component to vue_shared/markdown/markdown_content.vue (Better name suggestions are welcome)

The MR also includes:

  • Adding a new hcl language extension to the content editor's HighlightJS language loader
  • Implementing a new terraform.js syntax highlighting module for HCL
  • Updating tests

Changelog: added

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

Before After
Screenshot_2024-06-03_at_12.29.56_PM Screenshot_2024-06-06_at_3.51.06_PM

How to set up and validate locally

  1. Enable the feature flag in rails console:
Feature.enable(:index_terraform_module_archive)
  1. On HashiCorp Terraform registry, choose any module to test with, then go to its source code on GitHub and download it as a zip file.
  2. From your terminal, use cURL to publish the module you just downloaded: https://docs.gitlab.com/ee/user/packages/terraform_module_registry/#using-the-api
curl --location --header "PRIVATE-TOKEN: <your_PAT>" --upload-file <module_zip_file> "http://gdk.test:3000/api/v4/projects/<project_id>/packages/terraform/modules/my-module/my-system/0.0.1/file"
  1. Visit Project|Group > Operate > Terraform modules
  2. Visit the details page & check Readme is rendered in a tab.

Related to #438060 (closed)

Edited by Rahul Chanila

Merge request reports