Skip to content

feat: add grafanaDependency analyzer#513

Open
xnyo wants to merge 14 commits intomainfrom
giuseppe/semver-grafana-cloud
Open

feat: add grafanaDependency analyzer#513
xnyo wants to merge 14 commits intomainfrom
giuseppe/semver-grafana-cloud

Conversation

@xnyo
Copy link
Member

@xnyo xnyo commented Feb 13, 2026

Adds a new grafanadependency analyzer that checks that the grafanaDependency value in plugin.json is valid.

For now, the analyzer only has one rule that will result in a warning if the grafanaDependency has no pre-release value:

  • Bad: 12.4.0
  • Good: 12.4.0-0

This ensures the plugin can be installed in Grafana Cloud.

Since this is usually only an issue with Grafana Labs plugins, the rule is evaluated only for Grafana Labs plugins for now.

@xnyo xnyo self-assigned this Feb 13, 2026
@xnyo xnyo added the enhancement New feature or request label Feb 13, 2026
@xnyo xnyo changed the title wip: feat: add cloudversion analyzer wip: feat: add grafanaDependency analyzer Feb 13, 2026
@xnyo xnyo moved this from 📬 Triage to 🧑‍💻 In development in Grafana Catalog Team Feb 13, 2026
@xnyo xnyo changed the title wip: feat: add grafanaDependency analyzer feat: add grafanaDependency analyzer Feb 13, 2026
@xnyo xnyo marked this pull request as ready for review February 13, 2026 12:58
@xnyo xnyo requested review from a team as code owners February 13, 2026 12:58
@xnyo xnyo requested review from Ukochka, academo, s4kh and wbrowne February 13, 2026 12:58
@xnyo xnyo moved this from 🧑‍💻 In development to 🔬 In review in Grafana Catalog Team Feb 13, 2026

// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
// Modified to work with semver range operators (>=, >, <, <=) by removing ^ and $ anchors
var semverRegex = regexp.MustCompile(`(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it better to use a semver library for this? there are some, more complex ranges out there like this

Copy link
Contributor

@s4kh s4kh Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were to validate with semver lib, shouldn't we include it in the metadatavalid check? Remove the grafanaDependency object from the schema so schema validation passes and validate the actual value of grafanaDependency with SemVer lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 🔬 In review

Development

Successfully merging this pull request may close these issues.

3 participants