Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a plugin publishing best practices guide. #1158

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
07e2aea
wip
tomglenn Sep 30, 2024
5221d00
Adds a publishing best practices guide
tomglenn Oct 2, 2024
990f347
Merge branch 'main' into tom/plugin-publishing-best-practices
tomglenn Oct 2, 2024
2cfcc07
Add link to publishing best practices in publish guide
tomglenn Oct 4, 2024
8f329a9
Clarify external plugins only
tomglenn Oct 4, 2024
04fe88c
Tweaks RE feedback
tomglenn Oct 7, 2024
e709f22
Update docusaurus/docs/publish-a-plugin/publishing-best-practices.md
tomglenn Oct 7, 2024
e031176
Further tweaks
tomglenn Oct 7, 2024
8b51c48
Merge branch 'main' into tom/plugin-publishing-best-practices
tomglenn Oct 7, 2024
d3e0f19
Update docusaurus/docs/publish-a-plugin/publishing-best-practices.md
tomglenn Oct 8, 2024
f6b1e5d
feedback tweaks
tomglenn Oct 8, 2024
aa1a79c
Merge branch 'main' into tom/plugin-publishing-best-practices
tomglenn Oct 8, 2024
cf2b34d
Add grafana cloud link
tomglenn Oct 8, 2024
0aa16cd
Update docusaurus/docs/publish-a-plugin/publishing-best-practices.md
tomglenn Oct 11, 2024
980f453
Update docusaurus/docs/publish-a-plugin/publishing-best-practices.md
tomglenn Oct 11, 2024
ae90ea5
Update docusaurus/docs/publish-a-plugin/publishing-best-practices.md
tomglenn Oct 11, 2024
c137512
Update docusaurus/docs/publish-a-plugin/publishing-best-practices.md
tomglenn Oct 11, 2024
fff10a2
Update docusaurus/docs/publish-a-plugin/publishing-best-practices.md
tomglenn Oct 11, 2024
f2e0a5a
Tweak contributing guidance
tomglenn Oct 11, 2024
81f4f9e
Merge branch 'main' into tom/plugin-publishing-best-practices
tomglenn Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 108 additions & 0 deletions docusaurus/docs/publish-a-plugin/publishing-best-practices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
id: publishing-best-practices
title: Publishing best practices
sidebar_position: 0
description: Best practices for publishing your plugin
keywords:
- grafana
- plugins
- plugin
- publish
- best practices
---

# Publishing best practices

When publishing a Grafana plugin, adhering to best practices ensures not only a smooth submission and review process but also a higher quality experience for users. By following established guidelines, you improve the plugin’s performance, security, and discoverability within the Grafana ecosystem, ensuring that your plugin stands out as a shining example of what a Grafana plugin can be.

This document outlines the essential best practices for you to follow before publishing your Grafana plugin. These recommendations will help you avoid common pitfalls, streamline the review process, and create a plugin that integrates seamlessly into users' workflows while maintaining the high standards expected in the Grafana ecosystem. Whether you’re fine-tuning your plugin’s functionality or preparing your documentation, following these practices will ensure that your plugin is optimized for success from the start.

tomglenn marked this conversation as resolved.
Show resolved Hide resolved
## Populating your plugin's metadata
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

Metadata plays a crucial role in making your Grafana plugin discoverable and user-friendly. Properly structuring the [metadata in your `plugin.json` file](../reference/metadata.md) not only helps users find your plugin in [Grafana’s plugin catalog](https://grafana.com/grafana/plugins/) but also provides essential details about the plugin’s functionality and compatibility.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

Here’s a breakdown of the key components to focus on:

**Plugin name (`name`)**
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

The name of your plugin should be clear, concise, and descriptive. It is the first point of interaction for potential users, so avoid overly generic or cryptic names. Aim for a name that reflects the plugin’s primary functionality, making it easy to understand its purpose at a glance.

**Description (`description`)**

The description field should succinctly summarize what your plugin does and why users should install it. Limit the description to two sentences, highlighting the core functionality and use cases. A well-written description not only informs users but also contributes to better search results in the catalog.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

**Keywords (`keywords`)**

Keywords improve the searchability of your plugin within Grafana’s catalog. Choose terms that accurately describe your plugin’s functionality and data types it supports (e.g., "JSON", "SQL", "visualization"). However, avoid keyword stuffing; irrelevant keywords will be flagged during the review process, potentially delaying publication.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

**Grafana version compatibility (`grafanaDependency`)**

Ensure your plugin specifies the minimum Grafana version it is compatible with. This guarantees that users running different versions of Grafana know whether your plugin will work for them. Regularly update this field as new versions of Grafana are released, and [run end-to-end tests](../e2e-test-a-plugin/introduction.md) to confirm compatibility with those releases.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

**Other Grafana plugin dependencies (`plugins`)**

If your plugin relies on any other published Grafana plugins in order to function correctly, be sure to add them to this array field. Plugins listed as dependencies here will be automatically installed by Grafana when a user installs your plugin.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

## Creating a comprehensive README

Your plugin's README file serves as both a first impression and a detailed guide for your users. Think of it as a combination of a storefront advertisement and an instruction manual - showing what your plugin can do, how to install it, and how users can make the most of it within their Grafana instances.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

To assist developers in crafting a high-quality README, we provide a [README template](https://raw.githubusercontent.com/grafana/plugin-tools/main/packages/create-plugin/templates/common/src/README.md) as part of the plugin structure generated by the `create-plugin` tool. This template ensures you cover the essential components while giving you flexibility to add more specific details.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

Beyond a basic overview of your plugin, its use cases, and requirements, there are additional elements you should consider including to help users understand the value and functionality of your plugin:

- **Screenshots or screen captures:** Visual aids often communicate better than text alone. Including screenshots or even video demonstrations allows users to quickly grasp the plugin’s capabilities and setup process, giving them confidence to use it effectively.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved
tomglenn marked this conversation as resolved.
Show resolved Hide resolved
- **Dynamic badges:** Badges provide quick, at-a-glance information about your plugin, such as the latest release version or whether it has passed security and code checks. Tools like [shields.io](https://shields.io/) can be used with the Grafana.com API to automatically update these badges whenever you publish a new version, adding transparency and trustworthiness to your plugin.
- **Contribution guidance:** Maintaining a plugin can be demanding, especially for solo developers. Clearly outlining how users can provide feedback, report bugs, or contribute code improvements helps foster community involvement, making it easier to maintain and improve your plugin over time.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

This structure ensures that your README is both informative and engaging, providing users with everything they need to confidently use and contribute to your plugin.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

## End-to-end testing

End-to-end (E2E) testing ensures that your Grafana plugin functions correctly across various environments and Grafana versions. It replicates real-world usage by testing the plugin in an environment similar to the end-user's setup. Implementing E2E tests helps catch issues before submission, saving time during the review process and ensuring a smoother user experience.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

**Key points:**

- **Test compatibility across versions:** Ensure your plugin works seamlessly with various versions of Grafana by setting up E2E tests targeting multiple releases.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved
- **Automate testing:** Integrate E2E testing into your continuous integration (CI) pipeline to catch issues early and frequently, reducing potential problems during review.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

For a comprehensive guide on setting up E2E tests, see our [E2E test a plugin](../e2e-test-a-plugin/introduction.md) section.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

## Validate your plugin

Before submitting your plugin for review, you should validate your plugin to ensure that it meets Grafana's standards for functionality, security, and structure. The easiest way to do this is by using the Plugin Validator tool. This tool checks for potential issues that could prevent your plugin from being accepted, such as security vulnerabilities or structural problems.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

**Key points:**

- **Run locally or in CI:** You can run the validator locally or integrate it into your CI workflow to automate the validation process.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved
- **Validation reports:** The tool generates a report, highlighting any errors or warnings that need to be addressed before submission.

For more information on using the validator, refer to the [Plugin Validator documentation](https://github.com/grafana/plugin-validator).

## Provide a provisioned test environment

Provisioning a test environment for your plugin can significantly reduce the review time and make it easier for others to test and contribute to your plugin. A provisioned environment includes a pre-configured Grafana instance with sample dashboards and data sources that demonstrate your plugin's functionality.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

**Key points:**

- **Why provisioning matters:** It ensures that both reviewers and contributors can quickly verify your plugin's behaviour without manual setup, speeding up the review and collaboration process.
- **Automated setup:** You can provision test environments using Docker to create an out-of-the-box experience that replicates a typical Grafana setup.

To learn more about setting up provisioned environments, check out our [provisioning guide](../publish-a-plugin/provide-test-environment.md).
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

## Automating releases with GitHub Actions

To streamline your plugin development workflow, it's a best practice to automate releases using GitHub Actions. Automating this process helps ensure that your plugin is built, signed, and packaged correctly on each release, reducing human error and expediting the publishing process.

**Key points:**

- **Continuous integration (CI):** Use GitHub Actions to automatically build and test your plugin on every commit or pull request, catching issues early.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved
- **Release workflow:** Automate the signing and packaging of your plugin when you're ready to publish, ensuring it meets the necessary criteria for submission to the Grafana plugin catalog.

For detailed setup instructions, refer to our [Automate packaging and signing with GitHub](../publish-a-plugin/build-automation.md) guide.

## Next steps

By following these best practices - such as carefully populating metadata, creating a comprehensive README, validating your plugin, provisioning test environments, and automating releases - you significantly increase the chances of a successful plugin submission. Each step is designed to ensure that your plugin not only passes our review process but also delivers an exceptional experience for users. Adopting these practices will streamline your workflow and help create plugins that stand out in the Grafana ecosystem.
tomglenn marked this conversation as resolved.
Show resolved Hide resolved

Once your ready for your plugin to be published, head on over to Grafana Cloud and follow our guide for [submitting your plugin for review](../publish-a-plugin/publish-or-update-a-plugin.md) - we look forward to seeing what you create!
tomglenn marked this conversation as resolved.
Show resolved Hide resolved
Loading